RoiActivity input/output

245 views
Skip to first unread message

Pedro Lacerda

unread,
Aug 2, 2016, 4:24:11 PM8/2/16
to Bonsai Users
Hey.

I want to make one ROI depedent on another: one outer square and an inner that is exactly 200 px from each of the edges of the outer ROI. And then compare the time the mouse l spend inside and outside of the inner region.


When I try to externalize properties of RoiActivity it expects a OpenCV.Net.Point[][], which makes sense many points for many regions. However when I try to get these points from the first node I can only get a OpenCV.Net.Point[]. I guess it is only outputting the points from one of the regions, I don't know.

Bottom line is, I'd like to get the vertices of the first RoiActivity, do some math with it, and then input them to the second RoiActivity.

Any ideas?

Cheers,
Pedro

Gonçalo Lopes

unread,
Aug 2, 2016, 9:12:37 PM8/2/16
to Pedro Lacerda, Bonsai Users
Hey Pedro,

If the regions are both rectangular, why not just use two Crop nodes, one after the other?

The Crop coordinates are always relative to the original image, so if you apply one crop first, now the coordinates of the second crop will always be relative to the first image (i.e. you can move the first crop rectangle around and you don't have to change anything about the second crop).

Careful that you probably don't want to change the size of the first crop (this was already a problem if you wanted to make the crop be a specific fixed distance from the outer). You can enforce this if you only ever move the crop by clicking inside the rectangle and dragging it around. Bonsai ensures that the width and height stay the same if you are only applying a translation. Another way to do this is manually by only changing the X and Y of the first crop rectangle.

Hope this helps, if not we can get fancier. By the way, you can get the activity inside the crop by just summing all pixels with Sum. That's basically what RoiActivity is doing, it just makes it slightly easier if you want to measure this for many regions simultaneously.

Cheers,

--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users...@googlegroups.com.
Visit this group at https://groups.google.com/group/bonsai-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/8a8a087a-91a1-4d16-88b9-79cd0a0e4fee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages