Hope this helps!
So the basic idea is that you compute the activation for each ROI, as you are probably doing already, and then you combine everything using Zip. Then what you need to do is check which ROI was maximal, but also keep track of which ROI generated that maximal activation. This is done in the ExpressionTransform.
Finally, now that you have the maximal activation and which ROI was the maximum you create 3 branches, one for each reward port/led and check (the green Condition nodes) whether the maximal ID matches any of the specified branches and whether its activity exceeds the threshold. If that's true, you write to the DigitalOutput.
I'm assuming you want to keep different thresholds for each of the ROIs. If a single threshold would do, you could drop the branch-and-merge section and use a single condition.
Be aware that if you don't have anything else using Arduino in your workflow, having all this inside SelectMany will basically switch the Arduino on and off every time (because it is only in use while handling this event). This may add a significant latency to process the TTL. In order to avoid this, you can actually place the last DigitalOutput following the SelectMany, so that it is always "active".
Where basically for every input, you take a Boolean, write it to the Arduino, then wait for some amount of time (Delay), flip the Boolean (BitwiseNot) and write it back to the Arduino. In fact, looking at this you may not even need the SelectMany, and maybe it just works to paste this sequence to the end of the activation workflow you have now.
Hi Martin,
Does the inter-trigger interval in the ephys match the interval distribution you get from video acquisition timestamps?
--
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/d25fdf2e-7fa0-49cf-b829-f6189c3b0b35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
This makes me think the frame loss happens at the beginning or the end. Let’s go step by step. Can you split the workflow into two separate Bonsai files that you can run independently? I need to know the answer to the following questions:
1. If you start ephys with no video capture node, do you still see pulses?
2. If you stop video capture but keep ephys running, do you still see pulses?
Martin
I'd like to ask one more question - in my CorrectArmChange at the moment I only check that the mouse navigates the M maze arms in order, without skipping (inner arm to outer arms and vise versa), burns out I need to keep track of last two ROI activations to only reward the mouse on one of the following sequences (these being the only valid arm navigations):
1 -> 2 -> 3
3 -> 2 -> 1
2 -> 3 -> 2
2 ->1 -> 2
What would be the correct way of doing this ?
Best,
Polina
On Thursday, April 21, 2016 at 1:14:53 PM UTC+2, Polina Litvak wrote:Hello!
I am new to Bonsai and am hoping to be able to use it to track mouse motion in an M maze. The idea is to detect the animal's presence in one of a number of ROIs and then trigger an automated pellet dispenser to drop food when the animal is correctly positioned in a region.
For motion detection, I came across a post recommending to crop a region from the image and then sum all the segmented pixels in that region to get a continuous measure of how much the region has been activated. How can I access the segmented pixels of a region to be able to sum them up ? Is it something that can be configured using UI or do I need scripting for this ? An example would be greatly appreciated.
I also came across an alternative method of specifying MinArea in FindContours to track only when there is a large enough object in the ROI. Would that achieve the same end result ?
Many thanks!
Polina
--
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/d25fdf2e-7fa0-49cf-b829-f6189c3b0b35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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/e4565456-abb9-467b-ac6e-ef5f18eb61b1%40googlegroups.com.

To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/8b141a34-9fab-4e84-9e74-5f45352d4e0d%40googlegroups.com.

To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@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/5740ba58-dd9d-4839-85e0-ceaf1414b197%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@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/c3fd35fe-dd06-416b-b178-cead26427e75%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/d327cf2f-cca4-4870-ac41-5a4c84dfdfd6%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/492ba148-a808-45be-b159-232158ec2e91%40googlegroups.com.
Yes, you can. Add a Timestamp node after the ephys source and then create a branch with Take(1) and CsvWriter to save the data.
Not sure why it crashes when initializing with binning. Any error messages? Did the resize improve performance? Images are not terribly large…
Will look into the workflow later.
From: Martin Both
Sent: 05 September 2016 13:57
To: Bonsai Users
Cc: martin...@gmail.com
Subject: Re: [bonsai-users] Re: ROI motion detection
...sorry for the last sentence, I'm a bit in a hurry.
Martin
Cool, I try that.
Hope this helps.
On 30 August 2016 at 15:49, Martin Both <martin...@gmail.com> wrote:
Thank you, that works fine!
I tried to delay the video initialization, but I cannot put the DelaySubscription in front of the uEyeCamera node. Alternatively, is there a possibility to start the camera initialization triggerd by the end of the ephys initialization?
Am Mittwoch, 24. August 2016 17:23:46 UTC+2 schrieb goncaloclopes:
Hi Martin,
I'm curious, what happens if you use the DelaySubscription node to delay video initialization by 5 seconds for example? Are you able to compensate for this initialization delay?
Anyway, if you have access to an Arduino, something like the following workflow will suffice for the LED synch:
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/837071f0-eb13-4051-b707-372d98d28784%40googlegroups.com.
--
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+unsubscribe@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/913ffab7-6c5a-44c5-86d9-6df8f5e921b3%40googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/CAGV1SGLE1qcHcQcL64G0gXPDD86OFasxxFni%2BMN89S5jZL9%3DXw%40mail.gmail.com.
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/913ffab7-6c5a-44c5-86d9-6df8f5e921b3%40googlegroups.com.
--
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.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@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/28965e58-193c-471e-94ce-2602f65f3a58%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@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/547ebe7e-5990-4c67-86ba-8525faa1c57a%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/CAGV1SGLJ2BDSoy05rN2g%3D3Svge4E41aqT0VGz4YveXpxCG07aQ%40mail.gmail.com.
Hi Paolo,
Can you share the workflow you are using currently (i.e. the Bonsai file, not an image)? This will make it easier to understand and modify what you have so far.
From: Paolo Botta
Sent: 15 November 2017 22:31
To: Gonçalo Lopes
Cc: Bonsai Users
Subject: Re: [bonsai-users] Re: ROI motion detection
Yes, I would like to trigger the servo motor only after the alternation of two areas (A and B):
A-B, A-B, A-B, A-B (or even more repetitions of A-B sequence) that leads to turn on the servo motor.
The code should be a bit condensed as there will be other space sequences that trigger other servo motors.
So far I have managed to trigger the servo motor only when the animal enters in one area.
Any suggestion will be helpful.
Thanks a lot,
Paolo
Paolo Botta
Postdoctoral fellow, Costa lab
Zuckerman Institute
Columbia University
Tel. +1 3475253666 | Skype paolo...@gmail.com | LinkedIn
On Sat, Nov 11, 2017 at 6:52 AM, Gonçalo Lopes <goncal...@gmail.com> wrote:
Hi Paolo,
Just to clarify, would you like the two ROIs to be triggered in alternation constantly, i.e. first A, then B, then A, then B, and so on?
On 10 November 2017 at 19:48, Paolo Botta <paolo...@gmail.com> wrote:
Hi Goncalo,
Thanks for the link! Bonsai is great!
I have managed to trigger the servo motor with one visit in the ROI.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/547ebe7e-5990-4c67-86ba-8525faa1c57a%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@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/547ebe7e-5990-4c67-86ba-8525faa1c57a%40googlegroups.com.

