Here is the matlab data, where I'm trying to modify the dicom image pixels.
The dicom image is of 4D, 3d for the Rgb image and other dimension represents the fames. I take each frame and I modify the some specific pixel values and I try to save them whole dicom image data in raw format.
The reason why I'm saving it in raw format is that I want to use this data as file in dcmodify command of dcmtk. So, my first question is, am I saving the raw data in correct format? If not, kindly suggest me how I should do so. Moreover, do you know whether or not dcmodify command dcmtk can handle 4d data like in this case or it can only modify just one single frame? Thanks.
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);