How to make certain values zero of a plotted fit object.

I have plotted a "fit" object of a 3d matrix to provide a surface profile with the convenient spreadsheet type look. Each one represents a bioloigcal sample. There are some that fail and I would like color these black. I cannot access the data after "fit" has been done and I cannot "fit" data after making the failed cells=0. I altered the image in imagej to show an example of what I am hoping for.

 Accepted Answer

Figured it out. Just plotted my ROI rectangles at a height 10% above maximum value of surface. Pretty simple actually.

More Answers (1)

Record the fit object, say F . Do not ask to plot the fit object.
Now invoke the fit object on the data
[X, Y] = ndgrid(linspace(0,2000,47),0:8:400);
prediction = reshape(F(X(:), Y(:)), size(X));
Now...
ADmask = ones(size(prediction));
Now assign ADmask to 0 at the places that there were fails.
Then
image([min(X),max(X)], [min(Y),max(Y)], prediction, 'Alpha', ADmask);
Now whatever is "under" the image will show through. (If you do not specifically put something black there, then your grey axes color is what is likely to show up.)

6 Comments

image([min(X),max(X)], [min(Y),max(Y)], prediction, 'Alpha', ADmask);
Error using image
Unrecognized property Alpha for class Image.
Perhaps you meant imagesc()?
image([min(X),max(X)], [min(Y),max(Y)], prediction, 'AlphaData', ADmask);
This produces something weird and looks nothing like my orignal pic. So, I'm confused.
I've also attached example file Col 1 X positon, Col2 Y position 3&4 are width and height. Each column after is data at different times. Just not seeing the magnitudes on the below image. I am using col1, col2, col5 for this one. Thanks in advance for any help you can provide.
I would need your prediction object, F, to test
I am not clear as to whether col1, col2, col5 is the data that should appear, or if it is intended to be the locations of failures? I am not seeing anything like NaN in the data that might signal failure in an obvious way ?
First, I do very much appreciate your expertise in this matter. Attached is the prediction cvs and some images:
1. A manufactured image similar to my Goal. (Note my superior imageJ skills :)
2. Representation of positions of our ROIs. Referring to previously attached OutScat.csv: Top left corner of each rectangle Col 1: X, Col2 Y, 3&4 are Width & Height. Columns 5-59 are 54 separate data captures but let's stick with column 5 as our data.
3. Plot of fit object as calculated from (in this case) columns, 1,2 & 59.
I would like to remove the grid structure from the plot of the fit object data to have smooth look. Overlay ROI outlines and color black the ones that did not pass. Also not that the relative positions are overlaid pretty close but there seems to be missing data from the fit object. I suspect this is an edge effect, but I'll take any suggestion to perhaps predict out to edges of ROIs?
Figured it out. Just plotted my ROI rectangles at a height 10% above maximum value of surface. Pretty simple actually.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!