From: lovely_m M on
Hi Lead Bucket,

Great that you figured it out :) I've been trying to modify the functions according to your description but I can't get it to work. Could you maybe post the exact changes you made?

Many thanks,
M
From: Lead Bucket on
"lovely_m M" <lovely_m(a)hotmail.nl> wrote in message <i0f3qn$eng$1(a)fred.mathworks.com>...
> Hi Lead Bucket,
>
> Great that you figured it out :) I've been trying to modify the functions according to your description but I can't get it to work. Could you maybe post the exact changes you made?
>
> Many thanks,
> M

Hi M,

First, I created a copy of the private directory .../toolbox/images/iptformats/private and dicomwrite so I didn't muck things up with the original version. Then, in the dicom_encode_jpeg_lossy.m file, I modified frames to reflect the true number of frames and added a for loop:

frames = size(X,4);
for p = 1:frames
tempfile = tempname;
imwrite(X(:,:,:,p), tempfile, 'jpeg');
......
%frames = 1;
......
end

Next, in dicomwrite.m I commented out the for loop that cycled through the frames, removed the dependency of X on p, and changed the destination to filename, all in the write_message subfunction:

......
%for p = 1:num_frames
......
[attrs, msg, status] = dicom_create_IOD(SOP_UID, X, map, ...
......
[attrs, msg, status] = dicom_copy_IOD(X, map, ...
,....
destination = filename;
%destination = get_filename(filename, p, num_frames);
......
%end

That was it. It seemed to work fine for me here, although I was using the 'copy' option. I didn't test it for the other options. It gave me one or two warnings on one of the dicom variables not being correct, but I was okay with that.

Hope this works for you!
-LB