Align images to the side

For the reading of mammography images there are two views per breast. The straight edge touches the side of the laterality of the breast. However, typically you would like to have the images aligned to this edge (so that the images touch). How can I do this programmatically through the Python API?

Attached an example.

You can change what physical location is shown where in a slice view by adjusting SliceToRAS transformation. The current fitting algorithm (that places the slice view center at the volume center) is available here. You need to slightly tune this algorithm to shift the image to left/right by half of the difference between the volume’s width and the view’s width.

By the way, the huge empty space that off-centering the images may not look very nice at the end. So, instead of pushing the images to the sides, I would recommend to specify a custom layout that makes the slice views relatively narrow and tall (e.g., you can place additional views on the left or right from these slice views that you can resize using a splitter).

Thanks Andras, yes for mammography we would typically have four images next to each other (left right breast in two different views). I’ll try to make it work, and post the result here.

1 Like