changing the scale of the matrix of image (dicom)

조회 수: 10 (최근 30일)
Shel
Shel 2018년 8월 15일
댓글: Walter Roberson 2018년 8월 16일
I am going to change the scale of an image (dicom) by -1024. I made a matrix of M(1:512,1:512)=-1024. However, it is not possible to do the summation because the main matrix is a unit16. So my question is if it is possible to change the scale? if yes could you please give me the resource to learn it.
Thanks

답변 (2개)

Walter Roberson
Walter Roberson 2018년 8월 15일
You could do
M(1:512, 1:512) = M(1:512, 1:512) - 1024;
That would change only that part of the matrix. If the matrix is uint16 then any location that was less than 1024 before the subtraction would be set to 0.
Perhaps you want
newM = int16(M(1:512, 1:512)) - 1024;
Note: subtracting does not change the scale of an image: to change the scale you need multiplication or division.
I suggest you have a look at mat2gray() possibly followed by im2uint16()

Shel
Shel 2018년 8월 16일
Thanks for your response,
so the matrix can never have a negative value because it is uint16. my question is that to have the histogram of the matrix (I) in the range of (-1024, 3071), how I can change the uint16 matrix of I in the range of (0 4095). Is it possible at all? because I can make a double or int16 matrix of M(1:512,1:512)= -1024 but I cannot sum up them because of their different types.
Thanks

카테고리

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