mobie / mobie-viewer-fiji

BSD 2-Clause "Simplified" License
29 stars 12 forks source link

Measure distance between two points #1152

Closed tischi closed 2 weeks ago

tischi commented 3 weeks 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 3 weeks ago

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

tischi commented 3 weeks 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 3 weeks 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 3 weeks 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 3 weeks 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 2 weeks 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 2 weeks 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 2 weeks 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 2 weeks ago

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

jhennies commented 2 weeks ago

Awesome, exactly how I need it, thanks!

tischi commented 2 weeks ago

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