mobie / mobie-viewer-fiji

BSD 2-Clause "Simplified" License
33 stars 13 forks source link

Measure distance between two points #1152

Closed tischi closed 5 months ago

tischi commented 5 months ago

Several people requested interest in measuring the distance between two points.

We should check what the current functionality provides and how to improve this.

Relevant classes:

ping @jhennies

tischi commented 5 months ago

And, as discussed, indeed the "position" currently is: final double[] position = BdvPlaygroundHelper.getWindowCentreInCalibratedUnits( bdvHandle );

tischi commented 5 months ago

To reliably also obtain the position of the mouse pointer, I think a keyboard shortcut would be needed to execute this command (unless we have other ideas)?

tischi commented 5 months ago

We could make the CurrentLocationLoggerCommand always remember, in a static field, the previous position (could be also more than one, but maybe then confusing?) and then simply always print the distance from the current to the previous position (easy feature and maybe helpful?).

jhennies commented 5 months ago

Can you check how it was done in an earlier version of MoBIE? I think in Mobie 1.x, the log current position output was giving you the position of the mouse pointer

tischi commented 5 months ago

Can you check how it was done in an earlier version of MoBIE?

Seems to have been already for some time the window center.

jhennies commented 5 months ago

I agree, that's the last commit before it was changed to the window center (from 2021): https://github.com/mobie/mobie-viewer-fiji/commit/65d727466f68c769b73ba0658c72db20b013bf83

tischi commented 5 months ago

We could make the CurrentLocationLoggerCommand always remember, in a static field, the previous position (could be also more than one, but maybe then confusing?) and then simply always print the distance from the current to the previous position (easy feature and maybe helpful?).

Citing myself ☝️ , do you think that's a good idea?

jhennies commented 5 months ago

Ah, I missed that comment, sorry... Personally, I am already satisfied if I could get the current mouse position without the distance. But, considering there are use cases for a distance, your solution sounds good. It would be up to the user to do it correctly though, considering you would not be able to see the last point you clicked anymore. I would keep it simple, so good enough like this

tischi commented 5 months ago

@jhennies I uploaded a new version, how do you like it?

jhennies commented 5 months ago

Awesome, exactly how I need it, thanks!

tischi commented 5 months ago

Cool, if you by chance run into Paolo or Yannick, please let them know that this exists now 😉 .