Comments (10)
@RayInos thanks for the great find! How did you discover these private functions?
Two slight improvements, one to eliminate a deprecation warning and one to slightly improve performance:
persistent convertDataSpaceCoordsToViewerCoords;
if verLessThan('matlab','8.4.0')
xvert = local_Data2PixelTransform(ax,vert)';
xcp = local_Data2PixelTransform(ax,cp')';
else
if isempty(convertDataSpaceCoordsToViewerCoords)
convertDataSpaceCoordsToViewerCoords = specgraphhelper('convertDataSpaceCoordsToViewerCoords');
end
xvert = convertDataSpaceCoordsToViewerCoords(axchild, vert');
xcp = convertDataSpaceCoordsToViewerCoords(ax, cp);
end
from mrtools.
Hey everybody!
Since I was eager to get the select3d method working for mouse movement, the hit event didn't help a lot. Through some reverse engineering I found a Matlab intern function doing the job perfectly all right.
Replacing
% Transform vertices from data space to pixel space
xvert = local_Data2PixelTransform(ax,vert)';
xcp = local_Data2PixelTransform(ax,cp')';
with
% Transform vertices from data space to pixel space (fixed for Matlab>M14b)
if ~graphicsversion(get(ax,'Parent'),'handlegraphics')
xvert = specgraphhelper('convertDataSpaceCoordsToViewerCoords', axchild, vert');
xcp = specgraphhelper('convertDataSpaceCoordsToViewerCoords', ax, cp);
else
xvert = local_Data2PixelTransform(ax,vert)';
xcp = local_Data2PixelTransform(ax,cp')';
end
should work perfectly all right (tested with linear axes and DataAspectRatio=1).
One might change the condition ~graphicsversion(get(ax,'Parent'),'handlegraphics') to something more elegant. This code line assumes the axes object ax is direct child to the figure (which fits in my case). An alternative might be checking the matlab version with ~verLessThan('matlab','8.4'), since the graphics update came in 8.4 (R14b).
Note, that the transposition of vert and cp in the arguments of specgraphhelper(...) is crucial to the result. Transposing one of them leads to wrong results.
Happy selecting!
Ray
from mrtools.
Ugh. I was always worried about functions like this that people grab off of the Mathoworks site. Once they stop working there is no recourse since you don’t know how they work, they are poorly documented and you can’t fix what is likely a simple fix. If you have any ideas, let me know. I may get to it at some point, but can live with defining ROIs on surfaces and anatomy images if all else fails….
-j.
On Mar 30, 2015, at 3:44 AM, Denis Schluppeck [email protected] wrote:
yay! another matlab upgrade problem. the function select3d() can't access the undocumented axis properties on lines 329 onwards.
Happens when a surface is loaded as base and mrInterrogator running (on mouseMoveHandler() events).
xform = get(ax,'x_RenderTransform');
offset = get(ax,'x_RenderOffset');
scale = get(ax,'x_RenderScale');
These properties got deprecated in latest release. It doesn't look like there's an obvious fix but the same info might be (apparently?) wrapped up inside a property called DataSpace. Still need to check this.http://undocumentedmatlab.com/blog/customizing-axes-part-4-additional-properties` http://undocumentedmatlab.com/blog/customizing-axes-part-4-additional-properties%60
—
Reply to this email directly or view it on GitHub #25.
from mrtools.
yes - ugh. Completely agree. Maybe a solution is to wrap select3d()
with something like mlrSelect3d()
as per mlrFullCrosshair()
and do a matlab version check there, disabling selection on surfaces for ver>8.4 and warning for now. Then it'll be transparent later on, when we have found a fix/replacement for the functionality?
from mrtools.
Hey together. I had the same problem in another project. I replaced the code by what came to my mind first:
xform = view;
offset = [0 0 0];
scale = [1 1 1];
That works fine, YET. I have not tested it very long. Hopefully, it helps you, too, or gives a hint for a better replacement.
from mrtools.
Thanks Raylnos, but I'm not sure that will work - that makes the code not crash, but it is not the right view xform, offset and scale so probably won't return the correct point. This comment from a user on the "undocumentedmatlab" forum looks promising though (suggest that we can get rid of select3d and use matlab features:
Konstantin Alexeev says:
May 7, 2015 at 5:14 am
Hello Yair,
I used the select3d tool from matlab file exchange to find, where the mouse clicked on 3d, surface. Since matlab 2014, the select3d function seems to don’t work anymore because, “x_RenderTransform” and other propertiese were removed.
However, now the matlab provides the coordinates of the section of mouse point and the surface as the second parameter of the surface callback.
K>> varargin{2}
ans =
Hit with properties:
Button: 1
IntersectionPoint: [20.8219 16.8589 20.7370]
Source: [1x1 Surface]
EventName: ‘Hit’
from mrtools.
Just put in a fix for this in the latest commit. Used callbacks on the surfaces (see comment above) which in the latest matlab returns the "IntersectionPoint" above which tells you where the user clicked. Could not find a way to do mouseMoves (since the callback MouseDown is the only one that seems to be implemented by mathwork).
from mrtools.
@OfekShilon @RayInos
Heaps of thanks for this fix! Works great for me (and would have never sorted this without your help.
Cheers, Jon
from mrtools.
OfekShilon's solution does work for MatlabR2017a. Thanks.
from mrtools.
Hi, I encounter the error "Undefined function or variable 'specgraphhelper'. " in R2019a when I used select3d. Is there any suggestions to correct this? Thank you. Besides, I found the property of axes "x_RenderTransform" seems not existed. "There is no x_RenderTransform property on the Axes class. "
from mrtools.
Related Issues (20)
- Add menu item to mlrLIfePlugin for running dt6
- Automatically detect and fix paths for vista/mrTools HOT 1
- Remove as many dependencies to vista as possible
- in mlrLifePlugin auto detect whether MBA and LIfe are installed and offer way to install it through git HOT 1
- Change gamma to alpha HOT 1
- (Future Compatibility Issue): Figure handles are no longer numbers as of Matlab 2014b HOT 12
- (Future Compatibility Issue): HOT 2
- (Future Compatibility Issue): saving mat files containing new-style fig handles
- Motion Comp appears to reset FramePeriod on CNI data HOT 2
- No stimefile matching when mrInit is called from dofmricni HOT 1
- Convert Cortical Depth Deletes ROIs HOT 1
- mlrAnatDB Screenshots Don't Work w/ Multiple pRF Analysis HOT 4
- switching to mrTools from mrVista HOT 2
- Problem with times-series file naming when writing files in quick succession HOT 1
- importing flat surfaces from freesurfer HOT 2
- Using mrInterrogator functions (like EventRelatedPlot, etc) when clicking within an ROI HOT 1
- R2019a weirdness with plugins HOT 3
- Issue mrLoadRet
- Issue in merging analysis
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mrtools.