- registration getting better
This commit is contained in:
1 parent
e677e7400b
commit
bb3d46cc9d
3 files changed
+136
-304
No files matched your search
+29
-11
@@ -59,23 +59,41 @@ impl RegistrationStep {
|
||||
|
||||
/// Default registration steps matching elastix `FixedSmoothingImagePyramid`.
|
||||
///
|
||||
/// Smooth-only multi-resolution pyramid (no downsampling).
|
||||
/// Schedule [8, 4, 2, 1] → σ = [4.0, 2.0, 1.0, 0.5] at spacing=1.
|
||||
/// Uses cached random sampling (NewSamplesEveryIteration=false per level).
|
||||
/// Uses a multi-resolution pyramid with downsampling matching SimpleElastix:
|
||||
/// schedule [8, 4, 2, 1] → σ = [4.0, 2.0, 1.0, 0.5] at spacing=1.
|
||||
/// 512 iterations per level, 2048–8192 cached random samples.
|
||||
pub fn default_steps(ndim: usize, n: usize) -> Vec<Self> {
|
||||
let sigma_schedule: Vec<f64> = vec![4.0, 2.0, 1.0, 0.5];
|
||||
let n_samples = (n / 16).clamp(2048, 8192);
|
||||
sigma_schedule
|
||||
.iter()
|
||||
.map(|&s| Self {
|
||||
sigma: Sigma::Absolute(vec![s; ndim]),
|
||||
samples: SamplingArg::Random(n_samples),
|
||||
if ndim == 1 {
|
||||
return vec![Self {
|
||||
sigma: Sigma::Absolute(vec![1.0; 1]),
|
||||
samples: SamplingArg::Random(2048.min(n)),
|
||||
n_bins: 32,
|
||||
tolerance: 1e-6,
|
||||
edge: 0.05,
|
||||
max_iterations: 1500,
|
||||
learning_rate: 4.0,
|
||||
learning_rate: 1.0,
|
||||
downsample: 1,
|
||||
}];
|
||||
}
|
||||
// Pyramid with downsampling: schedule [8,4,2,1], sigma [4,2,1,0.5]
|
||||
let sigma_schedule: Vec<f64> = vec![4.0, 2.0, 1.0, 0.5];
|
||||
let downsample_schedule: Vec<usize> = vec![8, 4, 2, 1];
|
||||
sigma_schedule
|
||||
.iter()
|
||||
.zip(downsample_schedule.iter())
|
||||
.map(|(&s, &d)| {
|
||||
let n_pixels = (n / (d * d)).max(4);
|
||||
let n_samples = n_pixels.min(8192).max(2048);
|
||||
Self {
|
||||
sigma: Sigma::Absolute(vec![s; ndim]),
|
||||
samples: SamplingArg::Random(n_samples),
|
||||
n_bins: 32,
|
||||
tolerance: 1e-6,
|
||||
edge: 0.05,
|
||||
max_iterations: 512,
|
||||
learning_rate: 1.0,
|
||||
downsample: d,
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user