How to solve the problem?

조회 수: 3 (최근 30일)
Darsana P M
Darsana P M 2018년 4월 12일
댓글: Darsana P M 2018년 4월 16일
I have a dicom image,I of size :
size(I)
ans =
716 1000 3
From this I took first 64 bits,like I(1:16),I(17:32),I(33:48),I(49:64) and did the encryption operation. So before sending it I would like to get back the remaining bits and thus get back the image?
I hope the question is clear.Here I took Ist rows upto 64. This is stored in suppose a variable A.How to get the remaining bits, so that if store the variable in B. So that after decryption of A,I can concatenate with B and get back the final image.
Can somebody help me out to get this?
  댓글 수: 5
Walter Roberson
Walter Roberson 2018년 4월 14일
Those are not the first 64 bits. The first 64 bits are probably I(1:4) or I(1:8)
However AES-GCM of a dicom image needs the first 64 bits of the dicom file itself, not of the image stored in the file.
Darsana P M
Darsana P M 2018년 4월 15일
편집: Walter Roberson 2018년 4월 15일
Sir, I have separated the dicom header data and pixel data using matlab functions as shown in the code below:
I = dicomread('C:\Users\Click Me\Desktop\NIELIT\images output\img.dcm');
info = dicominfo('C:\Users\Click Me\Desktop\NIELIT\images output\img.dcm');
Thus info contains patient data. I have used this part to produce key, IV and other inputs for AES-GCM algorithm. Then, as plaintext, I took the pixel data part, "I", as shown in the above code.
So then, I had the problem for encrypting data. I have written the code in such way that it takes,
A1=I(1:16)
A2=I(17:32)
A3=I(33:48)
A4=I(49:64)
Hence, I took the first 64 numbers of the matrix "I" and then did the encryption. So after encryption I have to concatenate the remaining numbers, and hence form the encrypted image. I have mentioned The size of I.
I would like to know, how to do the concatenation part of remaining bits in matlab.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2018년 4월 15일
A1bits = reshape((dec2bin(typecast(A1, 'uint8'), 8) - '0').', 1, []);
This will be a row vector. Once you have done this up to A4 then you can do
[A1bits, A2bits, A3bits, A4bits]
  댓글 수: 13
Walter Roberson
Walter Roberson 2018년 4월 15일
[YourMatrix(1,65:end), reshape(YourMatrix(2:end,:).', 1, [])]
However, I do not understand why you are taking the first 64 numbers or elements of the first row when you want the first 64 bits. Your array contains double precision precision numbers, so your elements are 64 bits each, so the first 64 of the first row would be 64 elements * 64 bits per element = 4096 bits. You are only producing a 64 bit hash, so you are losing 63*64 = 4032 bit positions in your output.
Darsana P M
Darsana P M 2018년 4월 16일
Thanks a lot for your response sir.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 DICOM Format에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by