sgoldenlab / simba

SimBA (Simple Behavioral Analysis), a pipeline and GUI for developing supervised behavioral classifiers
https://simba-uw-tf-dev.readthedocs.io/
GNU General Public License v3.0
288 stars 140 forks source link

ROI show shape info #387

Closed bancroftg closed 1 week ago

bancroftg commented 2 weeks ago

Show shape info button when generating ROIs is not working for me. I expected ROI size values to pop up in the 'Define shape' window, as demonstrated in the example: https://github.com/sgoldenlab/simba/blob/master/docs/ROI_tutorial_new.md#show-shape-size-information

I enlarged the ROI preference settings to ensure the text size and thickness would be visible and checked that these settings saved in the main menu. After doing this I clicked on 'show shape info' in the shape interaction panel, and still nothing appeared.

Additional context Is there a way for me to preset the size of my ROIs? For example, I would like my circular ROIs to have a radius of 70mm

sronilsson commented 2 weeks ago

Hi @bancroftg - thanks for reporting, I can see that the button mistakenly had been disabled by default in the latest version, so I enabled it. If you update simba with pip install simba-uw-tf-dev --upgrade how does it look on your end?

PS. I don't have a public method do draw ROIs from a preset radius/width/height.. I've had a few requests for it, but haven't got a good idea for how to implement it graphically/interactively in the GUI.

bancroftg commented 2 weeks ago

Thank you for your speedy response! The update worked great!

As for the ROI preset size, I figured it would function something like the input window in step 4 of "Defining ROIs", and the shape dimensions were part of the editable "shape attributes" the ROI settings. Then the "pixels per mm" conversion factor predefined in the video parameters would be applied when drawing. https://github.com/sgoldenlab/simba/blob/master/docs/ROI_tutorial.md#part-1-defining-rois-in-simba But I now see the note below about implementing this in future versions :)

For now, do you think it would work to directly edit the ROI_difinitions.h5 file?

sronilsson commented 2 weeks ago

Yeah, - you could but it may be a little tricky: the ROI_difinitions.h5 file, on top of my head, stores the geometries location and sizes as pixel values, there is no metric converted values, you would have to deal with that. I have an idea for a pop up window where you specify radius of circles or width and heights for rectangles and add them to your drawings. Give me till next week and I will stick it in the main program, but give me a nudge if I haven't got back to you.

sronilsson commented 1 week ago

Hi @bancroftg - I inserted an option to draw ROIs defined by specified metric sizes from user in the SimBA GUI, and I would appreciate feedback when you get a chance. If you update simba with pip install simba-uw-tf-dev --upgrade and have version 2.1.4 or more you should see it.

I am pasting instructions below for how to use it, as I haven't got it baked in to the documentation yet.

Please let me know what you think.

Simon

...................................................................................

DRAW SHAPES OF USER-DEFINED METRIC SIZES

First, open the File (ROI) drop-down menu at the head of the Region of interest window and click the Draw ROIs of pre-defined sizes option.

predefined_sizes_1

Once clicked, you should see the following pop-up opening allowing you to draw a range of different shapes with specified sizes. If you need a shape-type that is missing, consider letting us know through Gitter or by opening en issue on GithHub.

predefined_sizes_2

In the SETTINGS frame, fill in the name of your ROI, and choose its color, thickness, and ear tag size.

DRAW A RECTANGLE OF SET SIZE

To draw a RECTANGLE of set size, fill in its metric width and height in millimeter and click ADD RECTANGLE as in the video below:

predefined_sizes_rectangle.webm

DRAW A CIRCLE OF A SPECIFIC RADIUS

To draw a CIRCLE with a specific radius, fill in its metric radius in millimeter and click ADD CIRCLE as in the video below:

predefined_sizes_circle.webm

DRAW A HEXAGON SPECIFIC RADIUS

To draw a HEXAGON with a specific radius, fill in its metric radius in millimeter and click ADD HEXAGON as in the video below:

predefined_sizes_hexagon.webm

DRAW A HALF CIRCLE POINTING NORTH

To draw a HALF CIRCLE with a specific radius with its chunky part pointing UP, fill in its metric radius in millimeter, choose NORTH in the direction drop-down menu, and click ADD HALF CIRCLE as in the video below:

predefined_sizes_half_circle_north.webm

DRAW A HALF CIRCLE POINTING WEST

To draw a HALF CIRCLE with a specific radius with its chunky part pointing LEFT, fill in its metric radius in millimeter, choose WEST in the direction drop-down menu, and click ADD HALF CIRCLE as in the video below:

predefined_sizes_half_circle_west.webm

bancroftg commented 1 week ago

Hi Simon,

Thank you so much for adding this tool! It is working PERFECTLY for me.

Best, Grace

sronilsson commented 1 week ago

Cheers Grace, please let me know if you encounter any bugs or oddities 👍🏻