Changing a dicom image and saving it as raw data?

Here is the matlab data where I am trying to change the pixels of a dicom image.

The dicom image has 4D, 3d for the Rgb image, and the other dimension is celebrities. I take every frame and I change some specific pixel values โ€‹โ€‹and I try to save all of the dicom image data in raw format.

The reason I save it in raw format is because I want to use this data as a file in the dcmodify dcmtk command. So my first question is: am I saving raw data in the correct format? If not, kindly suggest me how I should do this. Also, do you know if the dcmmod command dcmtk can process 4d data, as in this case, or can it only change one frame? Thank.

clc
clear all
close all
img=dicomread('Bad001_2CH_01_anon.dcm');
%%implay(img);
[rows,columns,colors,frames]=size(img);
for i=1:frames
    img(1:25,:,:,i)=0;
    disp(i);
    figure(1)
    imshow(img(:,:,:,i))
end
fid=fopen('image.raw','w+');
cnt=fwrite(fid,img,'uint8');
fclose(fid);
0
source share
2 answers

You can look at gdcmimg and gdcmraw depending on what you really want to do

0
source

dmtk: " dcmodify - , , DICOM."

, , , , , , .

dmkt, , dicomread ( ), ( ), DICOM dicomwrite

DICOM, dicominfo, .

img = dicomread('originalfile.dcm');
metadata = dicominfo('originalfile.dcm');

% do something with the img

% save altered DICOM with metadata
dicomwrite(img, 'processedFile.dcm', metadata, 'CreateMode', 'copy');

:

dcmodify [options] writtenDicomFile

writtenDicomFile - , , [options] , .

0

Source: https://habr.com/ru/post/1726434/


All Articles