I am trying to mirror landmarks applied to one half of a skull across the midsagittal plane. Really, my aim is to landmark half of the skull, and mirror any points that are not on the midsagittal line, so as to create one complete skull.
Is there a way to do this in 3D slicer? If not, using my mrk.json files, is there another software that does?
First, you need to get a transformation matrix that transforms the midsagittal plane to a plane that is orthogonal to the world coordinate syatem left-right axis. Probably the easiest is to use the ACPC transform module for this (provided by SlicerNeuro extension). You don’t need to apply this transform to the image.
Then you place your landmarks and get them as a numpy array. To get the point coordinates mirrored to the midsagittal plane:
add a row of 1.0 values to the numpy array that contains each point position in a column (the result is the homogenous coordinates of the landmark points)
multiply this matrix from the left with the mirroring transform (4x4 matrix)
You can compute the mirroring transform by a simple matrix multiplication: inv(ACPC) * diag(-1,1,1,1) * ACPC (where ACPC is the ACPC transform computed by the ACPC Transform module).
Probably Microsoft Copilot or ChatGPT can generate the Python script from this description. You can run the script by copying it into the Python console.