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
272 stars 137 forks source link

Selective ROI request #335

Open Monica9577 opened 4 months ago

Monica9577 commented 4 months ago

Is your feature request related to a problem? Please describe. I am interested in analysing the head direction toward two specific ROI but for the rest of them I just need the number of entrys, time spent, velocity... this kind of parameters.

as far as I know in the current simba version, when creating the visualize roi features (and select to show directionality) it creates a video where it shows the direction to ALL ROIs specified in the video. (Please find attached an example).

https://github.com/sgoldenlab/simba/assets/160180401/d459c7ae-7b15-4086-ac7f-5b1726e04bed

this other video represents the ideal directionality but we have to create the rest of the ROIs separete it

https://github.com/sgoldenlab/simba/assets/160180401/164b035e-8970-473b-b208-3525109df712

Describe the solution you'd like It would be wonderfull if in this visualize roi features you can choose the body part you are interested in AND a selection of ROIs you want the directionality to be plotted.

Captura de pantalla 2024-02-22 010258

Thankyou very much for your excellent work and effort

sronilsson commented 4 months ago

Hey @Monica9577 ! Yes I think I understand - you’re looking for an option to suppress directionaly visualization to some ROIs?

The most obvious solution would be as you say, providing checkboxes for each ROI, and then you check the boxes for the ROIs you want to show directionality for in the GUI menu. BUT, some users have many ROIs (e.g., say 10-20), and the menu would become very big, or it would be a pop-up inside the pop-up, but I can see the menu becoming confusing for some users..

Another alternative would be that we provide a jupyter notebook example, where you can specify the select ROI names similar to these HERE so you can create the videos with the select ROIs without using the GUI, do you think that could work?

EDIT:

E.g., THIS notebook gives you ROI features without using GUI, we could write a similar one that also includes the ROIs that should be considered for directionality?

Monica9577 commented 4 months ago

Yes ! I'm looking for an option to suppress directionaly visualization to some ROIs

I think maybe this edited version you're offering could work out

Thanks for the quick response

sronilsson commented 4 months ago

@Monica9577 do you think THIS could work? You'd need to copy that code over to a python script or notebook file in your SimBA environment and run it though.

Also, make sure you have simba version 1.86.3 or above installed for it to recognize the Directionality_roi_subset argument.

Monica9577 commented 4 months ago

hi Sorry, I'm not familiar with the notebooks usage What do you mean with copy it in my simBa environment ?

sronilsson commented 4 months ago

Hi @Monica9577 - alright, no problem we are all new to this!

Let me try to suggest some different.

1). Download the attached ZIP file and un-zip it.

2). Open the .py file in a text editor. E.g., Notepad or Textedit. and make some changes:

Change this line to be the actual ROI names you want to visualize, rather than My_first_polygon etc.

roi_subset = ['My_first_polygon', 'My_second_poygon']

Change this line to your actual project_config path: e.g.,CONFIG_PATH = c:\my_simba_project\project_config.ini

CONFIG_PATH = '/Users/simon/Desktop/envs/simba/troubleshooting/two_black_animals_14bp/project_folder/project_config.ini',

Change this to the actual name of the video you want to visualize, e.g., VIDEO_NAME = 'Monica9577.mp4`

VIDEO_NAME = 'Together_1.avi'
  1. Save the file and navigate to the directory of the file inside the Windows terminal. Once in the terminal, type:

    python roi_feature_visualizer_example.py
  2. Hit enter, voila, your video should be created fingers crossed :)

DOWNLOAD THIS FILE:

roi_feature_visualizer_example.py.zip