Agata
Agata

Reputation: 141

Error using imcontrast tool in MATLAB

I have a problem with imcontrast tool. I read 2D dicom image, then convert it to 16bits(im2uint16) and perform filtration and windowing using imcontrast. It shows me a warning message:

enter image description here

How Can I prevent then ? How can I change data range in imtool ?

I would appreciate for any help please.

Upvotes: 1

Views: 243

Answers (1)

Tapio
Tapio

Reputation: 1642

The [0,51156] is the range of the image data which change from image to image. [0, 65535] are the default color axis limits for uint16, which are outside the image data range, causing the re-adjust warning prompt. If you wish to silence the prompt you can manually set the color axis limits before calling imcontrast by:

caxis([double(min(min(Image))), double(max(max(Image)))]);

The conversion to double is to prevent a datatype mismatch. max() and min() return an uint16 value with uint16 data, which causes an another error down the line.

Upvotes: 1

Related Questions