dicomInfo = dicominfo('ID_0000_AGE_0060_CONTRAST_1_CT.dcm');
Error using dicom_getFileDetails
Unable to load file "ID_0000_AGE_0060_CONTRAST_1_CT.dcm".
Error in dicominfo (line 20)
fileDetails = dicom_getFileDetails(filename);
dicomImage = dicomread(dicomInfo);
[audio, sampleRate] = audioread('original_audio.wav');
audio = audio / max(abs(audio));
numSamples = numel(audio);
dicomVector = double(dicomImage(:));
maxSamples = numel(dicomVector);
if numSamples > maxSamples
error('Audio file too large to hide in the DICOM image.');
insertionStartTime = tic;
dctDicomImage = blockproc(dicomVector, [blockSize blockSize], @(block_struct) dct2(block_struct.data));
for row = 1:blockSize:size(dctDicomImage, 1)
for col = 1:blockSize:size(dctDicomImage, 2)
if audioIndex <= numSamples
dctDicomImage(row, col) = dctDicomImage(row, col) + audio(audioIndex)*10;
audioIndex = audioIndex + 1;
idctDicomImage = blockproc(dctDicomImage, [blockSize blockSize], @(block_struct) idct2(block_struct.data));
idctDicomImage(idctDicomImage < 0) = 0;
idctDicomImage(idctDicomImage > 255) = 255;
stegoDicomImage = uint8(reshape(idctDicomImage, size(dicomImage)));
dicomwrite(stegoDicomImage, 'stego_dicom_image.dcm', dicomInfo, 'CreateMode', 'copy');
insertionTime = toc(insertionStartTime);
stegoDicomVector = double(stegoDicomImage(:));
extractionStartTime = tic;
dctStegoDicomImage = blockproc(stegoDicomVector, [blockSize blockSize], @(block_struct) dct2(block_struct.data));
dctOrigDicomImage = blockproc(dicomVector, [blockSize blockSize], @(block_struct) dct2(block_struct.data));
extractedAudio = zeros(numSamples, 1);
for row = 1:blockSize:size(dctStegoDicomImage, 1)
for col = 1:blockSize:size(dctStegoDicomImage, 2)
if audioIndex <= numSamples
extractedAudio(audioIndex) = (dctStegoDicomImage(row, col) - dctOrigDicomImage(row, col))/10;
audioIndex = audioIndex + 1;
extractionTime = toc(extractionStartTime);
extractedAudio = extractedAudio - mean(extractedAudio);
extractedAudio = extractedAudio / max(abs(extractedAudio));
extractedAudio = extractedAudio * max(abs(audio));
audiowrite('extracted_audio_from_dicom.wav', extractedAudio, sampleRate);
dicomImage = uint8(dicomImage);
psnrValue = psnr(stegoDicomImage, dicomImage);
ssimValue = ssim(stegoDicomImage, dicomImage);
mseValue = immse(stegoDicomImage, dicomImage);
disp(['PSNR: ', num2str(psnrValue)]);
disp(['SSIM: ', num2str(ssimValue)]);
disp(['MSE: ', num2str(mseValue)]);
disp(['Insertion Time: ', num2str(insertionTime), ' seconds']);
disp(['Extraction Time: ', num2str(extractionTime), ' seconds']);
title('Original DICOM Image');
imshow(stegoDicomImage, []);
title('Stego DICOM Image');
title('Original Audio Signal');
title('Extracted Audio Signal');