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일

0 개 추천

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월 20일
Thanks for your answer. I'm using matlab R2013a on MS Windows 8.1 pro. I hasn't known that colormap just support 256 color. It doesn't have any notice in matlab helping center about that. You sure a bout that?
Walter Roberson
Walter Roberson 2015년 8월 20일
How about a direct statement from one of the developers? http://www.mathworks.com/matlabcentral/answers/47458#answer_58070
Mike Garrity
Mike Garrity 2015년 8월 20일
Yes, for many years the colormap was implemented on Windows using a GDI Palette, which meant a limit of 256 colors. Starting in R2014b, it is implemented on all platforms as a texturemap. This means that the max size is dependent on your graphics card, but 2,048 is pretty typical.
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일

0 개 추천

Don't use image(). Use imshow():
imshow(CT, []); % Be sure to use [].

댓글 수: 5

Nguyen Tan Duoc
Nguyen Tan Duoc 2015년 8월 15일
편집: Nguyen Tan Duoc 2015년 8월 15일
Thanks for your answer. I had known this way. It gave a good image. But i want to know what's wrong with my command colormap(C), with C=[a a a],a=[0:1/2062:1]'. why i got a weird color bar like that?
Image Analyst
Image Analyst 2015년 8월 15일
Was CT a floating point image (double)? That might be why. You might also need to fiddle with the caxis() function. With imshow() you don't have to worry about any of that - no need to do it manually since imshow() will do it automatically for you.
Nguyen Tan Duoc
Nguyen Tan Duoc 2015년 8월 15일
CT is uint16, not double. I got that figure after command:
a=[0:1/2062:1]';
C=[a a a];
colormap(C)
colorbar
I hadn't use function image yet!
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.

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

카테고리

도움말 센터File Exchange에서 White에 대해 자세히 알아보기

태그

질문:

2015년 8월 15일

댓글:

2015년 8월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by