How to put hit test off to Isosurface in matlab?

I am using the code
isosurface(foo,fo);
caxis([0.2 0.5])
colorbar
grid on; axis equal; colormap default; alpha(0.3);
hold on;
I would want to make the hit test off to the isosurface so that, by clicking on the figure ButtonDownFcn of axis can be called.

 Accepted Answer

Jan
Jan on 14 Jul 2013
Edited: Jan on 14 Jul 2013
You can call patch explicitly to define additional properties:
patch(isosurface(foo,fo), 'HitTest', 'off');

5 Comments

But this way you don't get the color. I have the cdata in fo.
@Vinith: Please read the documentation:
doc isosurface
Notice, that I cannot post a completely running example as long as you provide dummy code containing the undefined "foo" and "fo" only. You asked for disabling the HitTest and I showed you the method.
Am sorry
This is the kind of image I get. foo refers to the isovalues of the brain object and fo refers to the color values.
foo - 61x73x58 matrix fo - 61x73x58 matrix
thereby
isosurface(foo,fo) gives me the above brain object. Although when I click on the brain object I am unable to get the clicked location but on clicking on anywhere other than the axis I get the clicked location. For this I have to set the hittest of the brain object to off but am unable to do so. as by using
patch(isosurface(foo,fo), 'HitTest', 'off');
is the kind of image I get. Thank you.
So did you read doc isosurface already? There you find the exact description of how to provide the outputs of isosurface to patch (see "Example 2"):
[faces, verts, colors] = isosurface(foo, fo);
patch('Vertices', verts, 'Faces', faces, ...
'FaceVertexCData', colors, ...
'FaceColor','interp', ...
'edgecolor', 'interp', ...
'HitTest', 'off'); % <-- individual changes
If this does not help already, look at the other examples in the documentation.
ya thanks it worked.

Sign in to comment.

More Answers (0)

Asked:

on 14 Jul 2013

Community Treasure Hunt

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

Start Hunting!