How do I extract a decimal value from a 8 byte binary dicom tag?

3 ビュー (過去 30 日間)
Albin Lindvall
Albin Lindvall 2023 年 4 月 3 日
コメント済み: Albin Lindvall 2023 年 4 月 3 日
Hi!
I have a problem with extracting a dicom tag which I know is supposed to contain some form of a decimal value.
When calling dicomdisp the tag in question is displayed as:
0001074 0 (0011,103B) "" 8 bytes - Private_0011_103b *Binary*
When I try
pixelval=metadata.(dicomlookup("0011","103b"))
to extract the value I get the following output:
8×1 uint8 column vector
0
0
0
0
129
167
13
64
So how do I convert this column vector to the associated decimal value? Alternatively, extract the decimal value instantly.
I know this particular decimal number should have the value of "3.7067890167236328".
Thank you!

採用された回答

Rik
Rik 2023 年 4 月 3 日
You will need the typecast function:
typecast(uint8([0 0 0 0 129 167 13 64]),'double')
ans = 3.7068
This will conver the variable to a different datatype without changing the underlying binary data.
  1 件のコメント
Albin Lindvall
Albin Lindvall 2023 年 4 月 3 日
Thank you so much for the quick answer! That worked perfectly!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDICOM Format についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by