I have a specific Dicom image (uint16) and i want to multiply it with a mask (double) and then use the final image to generate other information. As I know it is better if an image is uint16 than double but in order to multiply those two i have to convert one of them as uint16 or double..My code works right only when i turn my image into double, otherwise it returns me black image..Is there any differnece between double and uint16 images?What can I do to make my code work right and have uint16 image??

 採用された回答

Thorsten
Thorsten 2015 年 11 月 4 日
編集済み: Thorsten 2015 年 11 月 4 日

0 投票

You can convert the mask to uint16:
X = uint16(2^16*rand(10)); % sample image
M = zeros(size(X)); M(4:6, 6:8) = 1; % create sample mask
Y = uint16(M).*X; % combine image and mask

5 件のコメント

Ann G
Ann G 2015 年 11 月 4 日
First of all, than you very much for your answer..Secondly, could you explain to me: "M(4:6, 6:8) = 1;" ?
Thorsten
Thorsten 2015 年 11 月 4 日
編集済み: Thorsten 2015 年 11 月 4 日
This is just to set some values (rows 4:6 in columns 6:8) in the matrix M to 1 for testing; I changed the code above to make that more clear.
Ann G
Ann G 2015 年 11 月 5 日
unfortunately it still returns me black image!! Thanks anyway!! I guess I'll work on double image!
Thorsten
Thorsten 2015 年 11 月 5 日
Maybe it just looks black. If you use imshow, the default range from black to white is 0..65535. You can use imshow(X, []) to adapt the range to the values in the image.
Ann G
Ann G 2015 年 11 月 5 日
I've checked the values and they are all 0.There must be something wrong when I multiply them..My results though are correct even with double image..

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeConvert Image Type についてさらに検索

質問済み:

2015 年 11 月 4 日

コメント済み:

2015 年 11 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by