Problem with colormap!

9 ビュー (過去 30 日間)
Nguyen Tan Duoc
Nguyen Tan Duoc 2015 年 8 月 15 日
コメント済み: Image Analyst 2015 年 8 月 21 日
I have a CT image (a matrix 512 x 512) that has maximum value is 2062 and minimum ones is 64. I want to show it so that the maximum pixel get white and the minimum ones get black color. I tried to use function colormap(C), with C=[a a a], a=[0:1/2000:1]'.Then used function image (CT)to show it. I imagined a color bar that begin with black (at 1) and change along with shade value to white (at 2062 or less than that a little). But i got a figure with weird color bar. It's discrete and just black and gray like the attached image (hadn't used function image(CT) yet). I'm wondering what's wrong!
  1 件のコメント
Nguyen Tan Duoc
Nguyen Tan Duoc 2015 年 8 月 15 日
Are there any error with Matlab? please help me!

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

採用された回答

Walter Roberson
Walter Roberson 2015 年 8 月 15 日
This of course has nothing to do with the CT image; the question could have been posed without mentioning it.
On OS-X it looks fine:
My speculation is that you are using MS Windows and using a release before R2014b. Before R2014b, MATLAB on MS Windows only supported 256 entries in the color map. I am told that from R2014b onwards that the limit is substantially higher.
  5 件のコメント
Nguyen Tan Duoc
Nguyen Tan Duoc 2015 年 8 月 21 日
Thanks everybody!that's great answer.
Image Analyst
Image Analyst 2015 年 8 月 21 日
You're welcome. Hopefully your final decision was to use imshow() and not image() with that colormap you tried to create.

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2015 年 8 月 15 日
Don't use image(). Use imshow():
imshow(CT, []); % Be sure to use [].
  5 件のコメント
Image Analyst
Image Analyst 2015 年 8 月 15 日
Then how did you display the image?
Nguyen Tan Duoc
Nguyen Tan Duoc 2015 年 8 月 20 日
編集済み: Nguyen Tan Duoc 2015 年 8 月 20 日
I would display CT. But it was too weir with that color bar.

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

カテゴリ

Help Center および File ExchangeWhite についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by