SlicerMorph icon indicating copy to clipboard operation
SlicerMorph copied to clipboard

Transfer the grids form one sample to the next using the LMs

Open muratmaga opened this issue 8 months ago • 1 comments

We currently have to draw the grids on new samples every time. This requires people to follow a strict regiment of how they created the patch (e.g., if the order of the landmarks are 1-2-3-4 in one and 2-3-4-1, which would still be clockwise), the resultant grid ordering is not the same. In multiple samples this is prone to making mistakes.

Instead we can have them do on one sample as a template and then have the landmarks to transfer the grid structure to the new sample and automatically recreate the grid choosing the same coordinates. Then the user would simply tweak the grid lines in problematic areas and then finalize the placement.

muratmaga avatar May 01 '25 19:05 muratmaga

Proposed solution:

  1. On reference specimen, during mergePatches(), capture and output a CSV/JSON recording:
  • Associated landmark node
  • Order of grids
  • For each grid, order of landmark indices used as corner points
  1. On target specimens, use the saved CSV to reconstruct each grid using the corresponding landmark coordinates, based on the logic called by onCreateGridFromPointsButton()

Considerations: We need a mechanism to track the index of manual landmarks used as grid corners after the fact. This could be captured at grid creation in the landmark name or description. The reference landmark node could be captured during the merge step.

Longer-term recommendation: Encapsulate this logic in a GridPatch class, which can store:

  • Corner coordinates
  • Associated landmark node, if present
  • Order of landmark indices

smrolfe avatar Jun 12 '25 19:06 smrolfe

A little summary of our understanding of the task, and how we'd approach it.

Assumptions:

  • The models and landmarks of the reference subject and new subjects are not spatially registered (if you load the reference specimen and a new one, then they will not overlap)
  • The fiducial node of the landmarks contain the same number of landmarks and in the same order (e.g. in the mouse skull we use for testing, A_J_Skull, CBA_J_Skull there are 51 landmarks in both, and in the same order), at least for each template

Proposed initial plan:

  • We write out a JSON with the data of the template to save
    • Number of specimen landmarks (so that we can check if it is the same when loading, otherwise the template is not compatible with)
    • Index of the corner points
    • Properties (resolution, advanced settings)
  • Add button for saving template on the UI (suggestion about location welcome). It will save the "active patch" that is selected in the Place tab
  • Button for loading template
  • When loading template, we identify the corner points in the current specimen from the point indices stored in the template file, apply the properties (grid resolution and those in advanced) and create the new grid patch on the current specimen

Questions:

Do we want to store/apply adjustments of the mid-points of the grid?

@muratmaga Please let us know what you think!

cpinter avatar Nov 27 '25 10:11 cpinter

I think this plan make sense. As for the adjustment of the mid points, not don't save them. This is not meant to be a fully automated method. We will expect the user to review and if necessary tweak them on per-specimen basis after the grid is transferred.

muratmaga avatar Nov 27 '25 20:11 muratmaga