Mesh plot threshold in MatLab
I am using an algorithm to determine a threshold for image analysis of nuclei in MATLAB. This algorithm measures all the pixel intensities within a nucleus and calculates a value that is used as a cutoff to distinguish background noise from foreground. I know how to apply this value to the image of the nuclei to see what effect the cutoff has, but I would like to apply the threshold to a mesh plot. By chance does anyone know how to do this I cannot post images yet but I have added example code of my image analysis
% First I load image i = imread('nucleus.tif') % I calculate the value of the threshold using my algorithm using my function ci99 = getCI99('nucleus.tif') % say for example that the calculated value is 100. I would apply this threshold to the image of the nucleus with the following command imshow(picture , [ 100, inf]) % The resulting image only shows pixels at and above the calculated threshold.
I use the following code to make a mesh plot of a nucleus
% Mesh Plot I=imread('nucleus.tif'); [x,y]=size(I); X=1:x; Y=1:y; [xx,yy]=meshgrid(Y,X); i=im2double(I); figure;mesh(xx,yy,i); colorbar figure;imshow(i)
I am trying to apply the cutoff to the mesh plot analogous to the way I apply the threshold to the original image.
I would really appreciate any help.
check out the Matlab clim function
you should be able to do this with:
you can also access particular plots by holding on to axis handles (kinda like pointers)
fig1 = figure; ax1 = mesh(xx,yy,i); colorbar; fig2 = figure; ax2 = imshow(i); set(ax1, 'clim', [100, inf]);
holding on to the axis handles lets you set parameters on any plot at any time, rather than only dealing with the last one you were working with.
Last note: try the image function rather than imshow. its not exactly the same thing, but you might find that you don't need to use the image processing toolbox at all.