I have a question regarding the format and content of the transformation matrix files outputted from the Slicer GUI versus the command-line. When manually performing a rigid registration within the Slicer GUI, I export the transformation matrix in .txt format and see the following:
The moving-to-fixed_Slicer.nii.gz volume outputted from the CLI is the same as the one generated from the Slicer GUI, however, the content and format of the transformation matrix file from the CLI is different:
Is there a reason for this difference? I’ve been able to use the transformation matrix manually outputted from the Slicer GUI for my workflow, and would like to automate the registration through the CLI. But I would like to have the same format as the transformation matrix manually exported from the GUI. Any help would be greatly appreciated.
When I run an affine registration between two images in the Slicer GUI vs CLI, the outputted images are again the same between the two, but the transformation matrices, although similar, are different enough to cause deviations when passing points through the transformations. Is this known behaviour or is there something that is missing from the CLI command. Here is the CLI command that I ran for the affine registration:
Slicer uses an RAS coordinate system internally, whereas ITK (and much of the rest of the medical imaging world) has settled on using an LPS coordinate system. Respecting this, exports from Slicer are automatically converted to use LPS, and imports from LPS are handled correctly. However, when you compare the internal representation of a transformation in Slicer with the same transformation in some other program they will not match because of the change in coordinate system.
I know I’ve seen this come up many times in the forum, so if you are looking for more information, keep searching here. Here is one related post I found:
When I had employed the above script, I got the following output where the absolute values were similar (not exactly the same) but not the signs (+/-). See below screenshot:
After making the above change in the np.diag, I get the following output, which matches more closely with what’s reported in the Slicer GUI (still slight variation in the values):
the issue is I have ac and pc points given to me in voxel coordinates (from the original T1 image). I used nibabel to convert to physical coordinates. I’d like to bring these points into ac-pc space. I can do this relatively easy using the Slicer GUI. I’m running into problems when using the Slicer command line.
The example conversion Python script in the script repository was incorrect. I don’t know where it has come from; it did something completely different than the C++ implementation and unsurprisingly, it did not compute correct results. I’ve replaced it now by a correct script.