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);
source
share