Page MenuHomePhabricator

[ROI] Support affine transforms as geometries
Closed, DuplicatePublic

Description

@m113r encountered rotated geometries in his images. Currently they do not work without resampling for ROIs as those are restricted to non-rotated geometries.

Hence, in version 2 of the MITK ROI file format, it should be possible to define Geometries by affine transforms as an alternative to origin and spacing. I suggest a 16 element JSON array called "Transform" that contains the 4x4 matrix of an affine transform.

Reminder:

4x4 matrix
d11 d21 d31 0
d12 d22 d32 0
d13 d23 d33 0
t1  t2  t3  1

Where d1, d2, and d3 are the space direction columns, each implicitly defining the spacing and together defining the 3x3 rotation matrix, and t is the translation/offset/origin vector.

So, for example, the transform of Pic3D with origin (0, 0, 0), spacing (1, 1, 3), and image size 256x256x49 is:

1 0 0 0
0 1 0 0
0 0 3 0
0 0 0 1

Which translates to the following JSON:

"Geometry": {
  "Size": [
    256, 256, 49
  ],
  "Transform": [
    1, 0, 0, 0,
    0, 1, 0, 0,
    0, 0, 3, 0,
    0, 0, 0, 1
  ]
}