How to save file in DICOM format without change the pixel value

6 visualizaciones (últimos 30 días)
mohd akmal masud
mohd akmal masud el 5 de Mzo. de 2025
Comentada: mohd akmal masud el 5 de Mzo. de 2025
Dear all,
I have file as attached. Then, I run this below script. But my problem is, when I try to save dicom format, the error pop up. Because cannot save in single type.
When I change to uin16 type, it can save in dicom format. But the problem is, value pixel i changed. I dont want the pixel valus is changeg.
clc
clear all
close all
sz = [128 128 128];
fname = 'point166ad.ict';
fid = fopen(fname);
data = fread(fid,'*float'); % assuming uint
fclose(fid);
data = reshape(data,sz);
imshow3D(data)
muwater = 0.182868;
mudata = data;
dataHU = ((mudata - muwater)./ (muwater-0))*1000;
figure, imshow3D(dataHU);
imstack34 = permute(dataHU,[1 2 4 3]);
dicomwrite( imstack34, "new4D.dcm");
  2 comentarios
Cris LaPierre
Cris LaPierre el 5 de Mzo. de 2025
The zip file contains an *.hct file, not the *.ict file the code needs.

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 5 de Mzo. de 2025
The datatypes for X in dicomwrite() is documented as
Data Types: int8 | int16 | uint8 | uint16
According to the article "Thirty Years of the DICOM Standard" https://pmc.ncbi.nlm.nih.gov/articles/PMC10610864/
Regarding the DICOM pixel data section, the support for floating point values (single precision 32-bit and double precision 64-bit) is limited to radiation dose values in radiotherapy and, more recently, to parametric maps defined as images in which the pixel values have been derived from the value stored by the modality to be the expression of a physical quantity. In all the other cases, DICOM pixel values can only be integers. DICOM uses a scale factor whenever the values stored in each voxel need to be scaled to different units. This is achieved through two fields specified in the metadata defining the slope and the intercept of the linear transformation to be used to convert pixel values to real-world values.
Therefore, using slope and intercept you could effectively get 16 bits fixed-point, but you cannot get 32 bits floating point, and that is a limitation built into DICOM format.

Categorías

Más información sobre DICOM Format en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by