Data cursor accuracy with imagesc

Hello everybody,
I need to increase the number of digits displaying by the data cursor when using it with imagesc. It's normally easy and can be done by editing the callback function by clicking "Edit Text Update Function" (see there for example : https://stackoverflow.com/questions/5961034/how-can-i-display-numbers-with-higher-precision-in-a-matlab-data-cursor ).
The issue is that, after changing this function, I obtain now only the values of X and Y and I have totally lost the values of "Index" and "RGB" normally displayed by the data cursor. Indeed, in the function that we change in "Edit Text Update Function", never "Index" or "RGB" appear. Do you now where the command that normally displays "Index" and "RGB" values is ? And, therefore, do you know how to solve my problem ? (ie: increasing the accuracy of X or Y without loosing the information "Index" and "RGB" normally showed by the data cursor).
I thank you in advance,
Best,
Alexandre
PS : Hereafter you can find a result of my data cursor before change and after change (I change the accuracy for displaying 6 digits instead of 4 for X and Y)

5 comentarios

Adam
Adam el 15 de Jul. de 2019
Editada: Adam el 15 de Jul. de 2019
The event_obj argument that you get for your UpdateFcn contains the X, Y information and the target, which is your image object. You can index into the CData of this to get either index or RGB information, potentially interpolating if you wish, depending if you are viewing a greyscale indexed image or a true RGB image. If the former you can further map your greyscale index onto the current colourmap to get the RGB data.
Alexandre LEGAY
Alexandre LEGAY el 15 de Jul. de 2019
Ok thank you I'm going to try. But do you know if there is a easier way than just define again all the display ? The display of "index" and "RGB" is surely implemented somewhere in Matlab and it seems easier to directly understand where in order to keep them when changing the data cursor callback function.
PS : I'm just using imagesc to display a 2D array. Thus, the index values are simply the values of the point (X,Y) of my array.
Adam
Adam el 15 de Jul. de 2019
I'm afraid I don't know where the default functionality is. I wouldn't have a clue what the function is called to even search for it. It's one of those graphics based things, like creating a toolbar with only a subset of the usual buttons on, that I am not aware how to do without having to reprogram all the functionality myself. Someone else might know.
Adam
Adam el 15 de Jul. de 2019
Actually, it is possible to find the function names used by using the profiler, but the function where I assume this code is - DataCursorManager.createDatatip is in a p-code file so is not viewable code.
Alexandre LEGAY
Alexandre LEGAY el 15 de Jul. de 2019
Ok ok no problem. Thank you very much. I'm going to try to work on that this evening by creating my own display thanks to your first answer. Have a nice day !

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Graphics Performance en Centro de ayuda y File Exchange.

Productos

Versión

R2018a

Preguntada:

el 15 de Jul. de 2019

Comentada:

el 15 de Jul. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by