Optimization issue: Particles clumping on a small section of the shape (Python API)

Hi everyone,

I am currently working with 2D closed femur contours and I have transitioned to using the Python API. I managed to get the grooming step working (all shapes are successfully aligned to the center), but I am running into a new issue during the optimization phase.

The Issue: The particles are not spreading evenly around the entire contour of the femur. Instead, they all cluster or get stuck on a very small portion of the bone.

Interestingly, the Analysis phase (PCA) actually works without throwing any errors, but since the particles are clumped together, it only analyzes that tiny section of the bone, completely ignoring the rest of the femur geometry.

Here is the parameter dictionary I am currently using in my Python pipeline:

Python

parameter_dictionary = {
        "number_of_particles" : 128,          
        "use_normals": 0,
        "normals_strength": 0.0,
        "iterations_per_split" : 200,
        "optimization_iterations" : 1000,
        
        "starting_regularization" : 1000,
        "ending_regularization" : 10,
        
        "initial_relative_weighting": 0.1,
        "relative_weighting" : 100,            
        
        "procrustes" : 1,
        "procrustes_interval" : 1,
        "procrustes_scaling" : 1,
        "procrustes_rotation_translation" : 1,
        
        "verbosity" : 0,
        "multiscale": 1,
        "multiscale_particles": 32,
        "narrow_band": 250,
}

My Question: Are there specific parameters I should tweak to force the particles to repel each other and cover the entire 2D contour? Could this be related to my relative_weighting, the starting_regularization, or perhaps a side effect of working with 2D data in the narrow band?

Any advice on how to fix this particle clumping would be greatly appreciated!

Thank you,

Marta

The first think I would try is to lower the initial relative weighting. During initialization, this is the balance between the mean position across all shapes and the repulsion forces. A value of 1.0 means that they are equal in weight. The default of 0.05 gives more weight to sampling, which spreads the particles out. You might try 0.001 if the default is not sufficient. I would also try without the multiscale mode to start with and increase the iterations per split to 1000.

Hi,

First of all, thank you so much for the previous replies, they were incredibly helpful and I’ve made good progress!

I am currently working with 2D femur contours, but I am still struggling to get the particles to cover 100% of the shape across all my patients. There are still some gaps where the particles just don’t want to spread.

I haven’t moved on to Phase 2 (correspondence optimization) yet, as I understand I need to achieve perfect coverage on all femurs first. Because of this lack of full coverage and correspondence, the “Overall Mean” in the Analyze tab looks like a messy jumble of overlapping points, which I assume is normal at this stage and will be fixed once Phase 2 is done properly.

Another issue I’m facing is that the program is now taking a very long time to iterate, so making small tweaks and waiting for the results is becoming extremely slow.

I will attach a screenshot of my Optimization screen. Here are the parameters I am currently using:

  • number_of_particles: 512

  • use_normals: 0

  • normals_strength: 0.0

  • iterations_per_split: 5000

  • optimization_iterations: 3000

  • starting_regularization: 100 (I lowered this to give the system more flexibility, but gaps remain)

  • ending_regularization: 10

  • initial_relative_weighting: 0.0001

  • relative_weighting: 100

  • procrustes: 1

  • procrustes_interval: 1

  • procrustes_scaling: 1

  • procrustes_rotation_translation: 1

  • verbosity: 0

  • multiscale: 0

  • multiscale_particles: 0

  • narrow_band: 250

  • use_geodesic_distance: 1

My questions are:

  1. What parameters would you recommend tweaking to force the particles to cover the remaining gaps without breaking the system?

  2. Is there a way to speed up the iteration times for 2D shapes?

  3. Would placing initial landmarks help guide the particles to cover the whole femur?

Any advice would be greatly appreciated. Thanks again!