Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Hacking's just another word for nothing left to kludge.


devel / comp.protocols.dicom / Re: Calculate Table Tilt (MR Scanner) & Image plane relative to body from Dicom Tags ??

SubjectAuthor
* Calculate Table Tilt (MR Scanner) & Image plane relative to body fromStephen Douglas Scotti
`* Re: Calculate Table Tilt (MR Scanner) & Image plane relative to bodyStephen Douglas Scotti
 `- Re: Calculate Table Tilt (MR Scanner) & Image plane relative to bodyStephen Douglas Scotti

1
Calculate Table Tilt (MR Scanner) & Image plane relative to body from Dicom Tags ??

<809b8abb-baf0-488e-901c-80bb73c432a9n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.protocols.dicom
X-Received: by 2002:a05:620a:1eb:b0:74e:17da:5d7d with SMTP id x11-20020a05620a01eb00b0074e17da5d7dmr11406qkn.13.1681884458213;
Tue, 18 Apr 2023 23:07:38 -0700 (PDT)
X-Received: by 2002:a05:622a:181b:b0:3e6:55b2:35f with SMTP id
t27-20020a05622a181b00b003e655b2035fmr800842qtc.5.1681884457961; Tue, 18 Apr
2023 23:07:37 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.protocols.dicom
Date: Tue, 18 Apr 2023 23:07:37 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=2001:4bb8:188:ea75:758c:d23d:f078:751;
posting-account=YFi_UAoAAACTPXmZqt1QuJHF4fLwCPfF
NNTP-Posting-Host: 2001:4bb8:188:ea75:758c:d23d:f078:751
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <809b8abb-baf0-488e-901c-80bb73c432a9n@googlegroups.com>
Subject: Calculate Table Tilt (MR Scanner) & Image plane relative to body from
Dicom Tags ??
From: stephen.d.scotti@gmail.com (Stephen Douglas Scotti)
Injection-Date: Wed, 19 Apr 2023 06:07:38 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3128
 by: Stephen Douglas Scot - Wed, 19 Apr 2023 06:07 UTC

It looks like a similar question has been asked before, and there is some information here:

https://dicomiseasy.blogspot.com/2013/06/getting-oriented-using-image-plane..html

I have a case where it would be nice to be able to dynamically extract:

1. Table Tilt of MR scanner.
2. Plane of instance / series relative to the body.

The sequences in question are actually 'resl' sequences from an Esoate MR scanner. Based on another reference I tried this python script, and at least for the instances that I have it seems correct, but I suspect there is more to it than that with the body position and table tilt ?
_______

#!/usr/bin/env python
import pydicom
import numpy as np # python -m pip install numpy
import os

"""
This function takes IOP of an image and returns its plane (Sagittal, Coronal, Axial)

"""

# Change the Working Directory to the Scripts Working Directory

cwd = os.getcwd()
# Print the current working directory
print("Current working directory: {0}".format(cwd))

abspath = os.path.abspath(__file__)
dname = os.path.dirname(abspath)
os.chdir(dname)
print("Current working directory: {0}".format( os.getcwd()))

def file_plane(IOP):
IOP_round = [round(x) for x in IOP]
plane = np.cross(IOP_round[0:3], IOP_round[3:6])
plane = [abs(x) for x in plane]
if plane[0] == 1:
return "Sagittal"
elif plane[1] == 1:
return "Coronal"
elif plane[2] == 1:
return "Axial"

directory = 'testfiles'
# iterate over files in
# that directory
for filename in os.listdir(directory):
f = os.path.join(directory, filename)
# checking if it is a file
if os.path.isfile(f) and f.endswith('.dcm'):
print('Processing file: '+f)

a=pydicom.read_file(f)
IOP = a.ImageOrientationPatient
plane = file_plane(IOP)
print(f + ': ' + plane +'\n')

Re: Calculate Table Tilt (MR Scanner) & Image plane relative to body from Dicom Tags ??

<ec0f80b7-c2e4-44e3-b3c3-124fa5b2947dn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.protocols.dicom
X-Received: by 2002:a05:622a:1a8d:b0:3e0:dee4:c925 with SMTP id s13-20020a05622a1a8d00b003e0dee4c925mr1172374qtc.5.1681911522642;
Wed, 19 Apr 2023 06:38:42 -0700 (PDT)
X-Received: by 2002:a05:620a:3996:b0:74e:962:dc24 with SMTP id
ro22-20020a05620a399600b0074e0962dc24mr541575qkn.0.1681911522342; Wed, 19 Apr
2023 06:38:42 -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: Wed, 19 Apr 2023 06:38:42 -0700 (PDT)
In-Reply-To: <809b8abb-baf0-488e-901c-80bb73c432a9n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:4bb8:188:ea75:7db4:d29:394e:4cce;
posting-account=YFi_UAoAAACTPXmZqt1QuJHF4fLwCPfF
NNTP-Posting-Host: 2001:4bb8:188:ea75:7db4:d29:394e:4cce
References: <809b8abb-baf0-488e-901c-80bb73c432a9n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ec0f80b7-c2e4-44e3-b3c3-124fa5b2947dn@googlegroups.com>
Subject: Re: Calculate Table Tilt (MR Scanner) & Image plane relative to body
from Dicom Tags ??
From: stephen.d.scotti@gmail.com (Stephen Douglas Scotti)
Injection-Date: Wed, 19 Apr 2023 13:38:42 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Stephen Douglas Scot - Wed, 19 Apr 2023 13:38 UTC

This is probably a better solution ?

Determining MR Image Planes, from Kaggle

https://www.kaggle.com/code/davidbroberts/determining-mr-image-planes

Stephen D. Scotti

Re: Calculate Table Tilt (MR Scanner) & Image plane relative to body from Dicom Tags ??

<78bfd056-e808-4614-897e-232dc084b80an@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.protocols.dicom
X-Received: by 2002:a05:6214:b85:b0:5ef:4390:3d34 with SMTP id fe5-20020a0562140b8500b005ef43903d34mr115400qvb.1.1681984957899;
Thu, 20 Apr 2023 03:02:37 -0700 (PDT)
X-Received: by 2002:a05:622a:289:b0:3ef:3541:435e with SMTP id
z9-20020a05622a028900b003ef3541435emr253921qtw.1.1681984957671; Thu, 20 Apr
2023 03:02:37 -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, 20 Apr 2023 03:02:37 -0700 (PDT)
In-Reply-To: <ec0f80b7-c2e4-44e3-b3c3-124fa5b2947dn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:4bb8:188:ea75:b406:4494:a87f:a732;
posting-account=YFi_UAoAAACTPXmZqt1QuJHF4fLwCPfF
NNTP-Posting-Host: 2001:4bb8:188:ea75:b406:4494:a87f:a732
References: <809b8abb-baf0-488e-901c-80bb73c432a9n@googlegroups.com> <ec0f80b7-c2e4-44e3-b3c3-124fa5b2947dn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <78bfd056-e808-4614-897e-232dc084b80an@googlegroups.com>
Subject: Re: Calculate Table Tilt (MR Scanner) & Image plane relative to body
from Dicom Tags ??
From: stephen.d.scotti@gmail.com (Stephen Douglas Scotti)
Injection-Date: Thu, 20 Apr 2023 10:02:37 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Stephen Douglas Scot - Thu, 20 Apr 2023 10:02 UTC

This little Python method also seems to work with the samples that I have.

I am curious to know if there is a Dicom Tag for the table tilt / elevation for MRI scanners that can be supine to upright ?

called with get_image_plane(ImageOrientationPatient)

def get_image_plane(loc):

row_x = loc[0]
row_y = loc[1]
row_z = loc[2]
col_x = loc[3]
col_y = loc[4]
col_z = loc[5]

# Calculate the normal vector to the image slice
normal_x = row_y * col_z - row_z * col_y
normal_y = row_z * col_x - row_x * col_z
normal_z = row_x * col_y - row_y * col_x

normal = [abs(normal_x), abs(normal_y), abs(normal_z)]

max_component = max(normal)
if max_component == normal[0]:
return "Sagittal "+str(max_component)
elif max_component == normal[1]:
return "Coronal "+str(max_component)
else:
return "Axial "+str(max_component)

Stephen D. Scotti

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor