Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

The two most common things in the Universe are hydrogen and stupidity. -- Harlan Ellison


devel / comp.protocols.dicom / Re: Decode rotation and translation values found into a 4x4 SRO affine transformation matrix

SubjectAuthor
* Decode rotation and translation values found into a 4x4 SRO affineAlessandro Ambrosini
+* Re: Decode rotation and translation values found into a 4x4 SRODavid Gobbi
|`* Re: Decode rotation and translation values found into a 4x4 SRODavid Gobbi
| `- Re: Decode rotation and translation values found into a 4x4 SROAlessandro Ambrosini
`- Re: Decode rotation and translation values found into a 4x4 SRO affine transformAlessandro Ambrosini

1
Decode rotation and translation values found into a 4x4 SRO affine transformation matrix

<e40a0c24-df02-4d51-a9c4-a53847bba2fbn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=163&group=comp.protocols.dicom#163

  copy link   Newsgroups: comp.protocols.dicom
X-Received: by 2002:a0c:8ccf:: with SMTP id q15mr14335600qvb.12.1627228158401;
Sun, 25 Jul 2021 08:49:18 -0700 (PDT)
X-Received: by 2002:a05:620a:911:: with SMTP id v17mr13758711qkv.458.1627228158136;
Sun, 25 Jul 2021 08:49:18 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.protocols.dicom
Date: Sun, 25 Jul 2021 08:49:17 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=185.194.202.29; posting-account=YH9VgAoAAADeTpSFyOrHdOuu93N-Dj3R
NNTP-Posting-Host: 185.194.202.29
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e40a0c24-df02-4d51-a9c4-a53847bba2fbn@googlegroups.com>
Subject: Decode rotation and translation values found into a 4x4 SRO affine
transformation matrix
From: aleambro@gmail.com (Alessandro Ambrosini)
Injection-Date: Sun, 25 Jul 2021 15:49:18 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Alessandro Ambrosini - Sun, 25 Jul 2021 15:49 UTC

Radiotherapy World :-)

During our daily process, for every patient we acquire a ConeBeam CT before radiation therapy.
Then, with a specific console and a dedicated software we do a coregistration from CBCT just acquired and the patient reference CT image. Then the software output the SRO data : 3 rotation angles (angle X,Y,Z : Euler's angles) and 3 translations as result of the matching. Then the system transmits all data with DICOM protocol to a central server.

Now I want, for further processing, to collect historycal matching data (rotations and translations) from many patients and post-process them.

Into the central server I've found, for every patient and every treatment, many DICOM files with SOP Class UID
"1.2.840.10008.5.1.4.1.1.66.1" Spatial Registration Storage
http://dicom.nema.org/dicom/2013/output/chtml/part03/sect_A.39.html#sect_A.39.1

Inside them I've found the SRO 4x4 affine transformation matrix into the DICOM tag (3006,00C6)
http://dicom.nema.org/dicom/2013/output/chtml/part03/sect_C.20.html#sect_C.20.2

After further investigations I've found how to decode the 3 angles using Euler Theorem with some Python code and pydicom module
https://en.m.wikipedia.org/wiki/Rotation_formalisms_in_three_dimensions#Conversion_formulae_between_formalisms

Angles are OK : they match perfect with angles showed in coregistration console.
But till now I'm not be able to decode translation data.
Dicom standard says:
Equation P-5 "...The fourth column [T1,T2,T3] is the origin of RCSB with respect to RCSA."
http://dicom.nema.org/dicom/2013/output/chtml/part17/chapter_P.html

So, if Tx , Ty , Tz numbers found inside the matrix are the "origin" of transformation, where can I found (or calculate) translation values as showed in coregistration console ?

This is an example.
Coregistration console, after matching, says to me these values:
TRANSLATION (CENTIMETERS)
X 0.2
Y 0.4
Z -0.1

ROTATION (DEGREES)
X -0.5
Y 0.4
Z 1.2

and this is the corresponding 4x4 affine transformation matrix found into SRO .dcm file:
[0.999756, 0.00698126, 0.0209421, -12.914,
-0.00679671, 0.999938, -0.00887082, 43.049,
-0.0210027, 0.00872632, 0.999741, 267.055,
0, 0, 0, 1]

With my Python code, I recalculate the 3x3 rotation submatrix
[0.999756, 0.00698126, 0.0209421,
-0.00679671, 0.999938, -0.00887082,
-0.0210027, 0.00872632, 0.999741]
and I get angles and they match with console :-)

But for numbers found into 1x3 translation matrix
[-12.914,
43.049,
267.055]
I cannot found a corrispondence with translation values showed me by coregistration console.

Any idea how to decode and get translation values as showed in coregistration console ?

Thanks

Re: Decode rotation and translation values found into a 4x4 SRO affine transformation matrix

<52ef2df4-aefd-474d-b084-9b5323a76bf3n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=164&group=comp.protocols.dicom#164

  copy link   Newsgroups: comp.protocols.dicom
X-Received: by 2002:a05:622a:188d:: with SMTP id v13mr15583184qtc.192.1627313919874;
Mon, 26 Jul 2021 08:38:39 -0700 (PDT)
X-Received: by 2002:a05:620a:a89:: with SMTP id v9mr17519105qkg.232.1627313919661;
Mon, 26 Jul 2021 08:38:39 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.protocols.dicom
Date: Mon, 26 Jul 2021 08:38:39 -0700 (PDT)
In-Reply-To: <e40a0c24-df02-4d51-a9c4-a53847bba2fbn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=198.48.161.196; posting-account=oJk4vAoAAAAuHqwGdLwYUlL776upyWJ3
NNTP-Posting-Host: 198.48.161.196
References: <e40a0c24-df02-4d51-a9c4-a53847bba2fbn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <52ef2df4-aefd-474d-b084-9b5323a76bf3n@googlegroups.com>
Subject: Re: Decode rotation and translation values found into a 4x4 SRO
affine transformation matrix
From: david.gobbi@gmail.com (David Gobbi)
Injection-Date: Mon, 26 Jul 2021 15:38:39 +0000
Content-Type: text/plain; charset="UTF-8"
 by: David Gobbi - Mon, 26 Jul 2021 15:38 UTC

> 4x4 affine transformation matrix
> [0.999756, 0.00698126, 0.0209421, -12.914,
> -0.00679671, 0.999938, -0.00887082, 43.049,
> -0.0210027, 0.00872632, 0.999741, 267.055,
> 0, 0, 0, 1]

I strongly suspect that the difference you see is due to the ordering of the transformations (translate then rotate, versus rotate then translate). Rotations are not commutative with each other or with translations, so the order is very important.

For a 4x4 matrix like the one above, the numbers in the last column are a translation that is applied after the rotation given by the 3x3 matrix. But perhaps the console is giving a translation that is applied before the rotation, rather than after?

There is an easy way to check. A pre-translation (applied before rotation) is equal to a post-translation multiplied by the inverse of the 3x3 matrix. And likewise, a post-translation is equal to a pre-translation multiplied by the 3x3 matrix.

Re: Decode rotation and translation values found into a 4x4 SRO affine transformation matrix

<09397e3a-734f-49a7-ba59-1d602823f53an@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=165&group=comp.protocols.dicom#165

  copy link   Newsgroups: comp.protocols.dicom
X-Received: by 2002:a05:6214:1882:: with SMTP id cx2mr18608375qvb.2.1627318221676;
Mon, 26 Jul 2021 09:50:21 -0700 (PDT)
X-Received: by 2002:ac8:4794:: with SMTP id k20mr15938927qtq.371.1627318221470;
Mon, 26 Jul 2021 09:50:21 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.snarked.org!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.protocols.dicom
Date: Mon, 26 Jul 2021 09:50:21 -0700 (PDT)
In-Reply-To: <52ef2df4-aefd-474d-b084-9b5323a76bf3n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=198.48.161.196; posting-account=oJk4vAoAAAAuHqwGdLwYUlL776upyWJ3
NNTP-Posting-Host: 198.48.161.196
References: <e40a0c24-df02-4d51-a9c4-a53847bba2fbn@googlegroups.com> <52ef2df4-aefd-474d-b084-9b5323a76bf3n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <09397e3a-734f-49a7-ba59-1d602823f53an@googlegroups.com>
Subject: Re: Decode rotation and translation values found into a 4x4 SRO
affine transformation matrix
From: david.gobbi@gmail.com (David Gobbi)
Injection-Date: Mon, 26 Jul 2021 16:50:21 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 8
 by: David Gobbi - Mon, 26 Jul 2021 16:50 UTC

> I strongly suspect that the difference you see is due to the ordering of the transformations (translate then rotate, versus rotate then translate). Rotations are not commutative with each other or with translations, so the order is very important.

Just replying to myself. The discrepancy between your console translation and the SRO translation is too large to be accounted for by the ordering of the operations. My next guess is that the center-of-rotation is defined differently for the console vs the SRO.

Re: Decode rotation and translation values found into a 4x4 SRO affine transformation matrix

<266083d5-3c79-419c-b404-995295d24630n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=167&group=comp.protocols.dicom#167

  copy link   Newsgroups: comp.protocols.dicom
X-Received: by 2002:a37:8242:: with SMTP id e63mr6277792qkd.294.1627577949024;
Thu, 29 Jul 2021 09:59:09 -0700 (PDT)
X-Received: by 2002:a05:6214:5186:: with SMTP id kl6mr5782533qvb.5.1627577948711;
Thu, 29 Jul 2021 09:59:08 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.protocols.dicom
Date: Thu, 29 Jul 2021 09:59:08 -0700 (PDT)
In-Reply-To: <09397e3a-734f-49a7-ba59-1d602823f53an@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=185.194.202.29; posting-account=YH9VgAoAAADeTpSFyOrHdOuu93N-Dj3R
NNTP-Posting-Host: 185.194.202.29
References: <e40a0c24-df02-4d51-a9c4-a53847bba2fbn@googlegroups.com>
<52ef2df4-aefd-474d-b084-9b5323a76bf3n@googlegroups.com> <09397e3a-734f-49a7-ba59-1d602823f53an@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <266083d5-3c79-419c-b404-995295d24630n@googlegroups.com>
Subject: Re: Decode rotation and translation values found into a 4x4 SRO
affine transformation matrix
From: aleambro@gmail.com (Alessandro Ambrosini)
Injection-Date: Thu, 29 Jul 2021 16:59:09 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Alessandro Ambrosini - Thu, 29 Jul 2021 16:59 UTC

Il giorno lunedì 26 luglio 2021 alle 18:50:22 UTC+2 david...@gmail.com ha scritto:
> > I strongly suspect that the difference you see is due to the ordering of the transformations (translate then rotate, versus rotate then translate).. Rotations are not commutative with each other or with translations, so the order is very important.
> Just replying to myself. The discrepancy between your console translation and the SRO translation is too large to be accounted for by the ordering of the operations. My next guess is that the center-of-rotation is defined differently for the console vs the SRO.

Solved (thanks to a my collegue).
Translation found into 4x4 matrix are absolute values against patient isocenter position.
I find isocenter position into the patient RTPLAN dicom file (SOP Class UID 1.2.840.10008.5.1.4.1.1.481.5 ) , tag (300a, 012c)

I simply calculate difference from rtplan isocenter and matrix value and BINGO: all works perfectly. Values are exactly as showed into coregistration console.
END, problem solved :-)

Re: Decode rotation and translation values found into a 4x4 SRO affine transformation matrix

<39f4f61e-bace-4255-91f3-0f1e1ba9bd67n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=168&group=comp.protocols.dicom#168

  copy link   Newsgroups: comp.protocols.dicom
X-Received: by 2002:a05:620a:29cf:: with SMTP id s15mr6309240qkp.363.1627577991677; Thu, 29 Jul 2021 09:59:51 -0700 (PDT)
X-Received: by 2002:a05:620a:f03:: with SMTP id v3mr6273165qkl.96.1627577991452; Thu, 29 Jul 2021 09:59:51 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!feeder1.feed.usenet.farm!feed.usenet.farm!tr2.eu1.usenetexpress.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.protocols.dicom
Date: Thu, 29 Jul 2021 09:59:51 -0700 (PDT)
In-Reply-To: <e40a0c24-df02-4d51-a9c4-a53847bba2fbn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=185.194.202.29; posting-account=YH9VgAoAAADeTpSFyOrHdOuu93N-Dj3R
NNTP-Posting-Host: 185.194.202.29
References: <e40a0c24-df02-4d51-a9c4-a53847bba2fbn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <39f4f61e-bace-4255-91f3-0f1e1ba9bd67n@googlegroups.com>
Subject: Re: Decode rotation and translation values found into a 4x4 SRO affine transformation matrix
From: aleambro@gmail.com (Alessandro Ambrosini)
Injection-Date: Thu, 29 Jul 2021 16:59:51 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 5
 by: Alessandro Ambrosini - Thu, 29 Jul 2021 16:59 UTC

Solved (thanks to a my collegue).
Translation found into 4x4 matrix are absolute values against patient isocenter position.
I find isocenter position into the patient RTPLAN dicom file (SOP Class UID 1.2.840.10008.5.1.4.1.1.481.5 ) , tag (300a, 012c)

I simply calculate difference from rtplan isocenter and matrix value and BINGO: all works perfectly. Values are exactly as showed into coregistration console.
END, problem solved :-)

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor