I made whole procedure in Matlab(2012a) where I used dcmodify to modify the pixels of an image.
The matlab code is as below:
Code: Select all
clc
clear all
close all
a=imread('Sunset.jpg');
dicomwrite(a,'Sunset.dcm');
figure
imshow(a);
a(20:46,:,1)=0;
a(20:46,:,2)=0;
a(20:46,:,3)=0;
dicomwrite(a,'Sunset1.dcm');
b=dicomread('Sunset1.dcm');
figure
imshow(b)
dos('dcmodify -mf PixelData=Sunset1.dcm Sunset.dcm');
c=dicomread('Sunset.dcm');
figure
imshow(c)
After the change in pixel I produce a new image, called "Sunset1.dcm" which looks like as below:
But when I modify the pixels of the 1st produced dicom image, "Sunset.dcm"(Shown in the first link), by taking the pixel data from the other dicom file or image, "Sunset1.set"(shown in the second link), the resulting image is absurdly like below:
Why does dcmodify change in such a bizarrely wrong way? Am I misunderstanding the functionality of dcmodify? Please explain.
Thanks.