register_real_images test working
This commit is contained in:
1 parent
0f315e66ca
commit
e677e7400b
6 files changed
+124
-70
No files matched your search
+17
-27
@@ -59,35 +59,25 @@ impl RegistrationStep {
|
||||
|
||||
/// Default registration steps matching elastix `FixedSmoothingImagePyramid`.
|
||||
///
|
||||
/// Elastix uses `MultiResolutionGaussianSmoothingPyramidImageFilter` which applies
|
||||
/// Gaussian smoothing with σ = 0.5 × factor at **full resolution** — images are
|
||||
/// **NOT downsampled**. See: `itkMultiResolutionGaussianSmoothingPyramidImageFilter.hxx`
|
||||
///
|
||||
/// Schedule [8, 4, 2, 1] means σ = [4.0, 2.0, 1.0, 0.5] (spacing=1).
|
||||
/// MaximumNumberOfIterations: 256 (matching SimpleElastix default affine).
|
||||
/// 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).
|
||||
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 nlevels = sigma_schedule.len();
|
||||
let mut steps = Vec::new();
|
||||
|
||||
for i in 0..nlevels {
|
||||
let fraction = 1.0 / 2.0_f64.powi((nlevels - 1 - i) as i32);
|
||||
let samples = (n as f64 * fraction)
|
||||
.sqrt()
|
||||
.max(n as f64 * fraction / 10.0)
|
||||
.max(2048.0) as usize;
|
||||
steps.push(RegistrationStep::new(
|
||||
Sigma::Absolute(vec![sigma_schedule[i]; ndim]),
|
||||
SamplingArg::Random(samples),
|
||||
32,
|
||||
1e-6,
|
||||
0.05,
|
||||
256,
|
||||
1.0,
|
||||
));
|
||||
}
|
||||
|
||||
steps
|
||||
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),
|
||||
n_bins: 32,
|
||||
tolerance: 1e-6,
|
||||
edge: 0.05,
|
||||
max_iterations: 1500,
|
||||
learning_rate: 4.0,
|
||||
downsample: 1,
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user