Need help to figure out what is causing Runtime Error

113 views
Skip to first unread message

pedro.bio...@gmail.com

unread,
Aug 28, 2017, 5:56:23 PM8/28/17
to Bonsai Users
Hey there, need some help. I'm terribly new at some of this, but please bear with me.
I'm doing a workflow to trace some mice, and I after Binary Region Analysis, if I right click and choose to add to the workflow any of the outputs under "Item (Bonsai.Vision.ConnectedComponent), I get an error when trying to run the workflow. It's a Runtime Error, with the description, which shows up in portuguese although everything else is in English (running Windows in PT language), "A operação pode destabilizar o tempo de execução", which roughly translates to "This operation might destabilize execution time". 
I've attached a pic of the workflow and error. 
I've looked around but can't find a solution. Any ideas?
Thank you very much
Runtime Error.PNG

Gonçalo Lopes

unread,
Aug 28, 2017, 9:24:09 PM8/28/17
to pedro.bio...@gmail.com, Bonsai Users
Hi Pedro and welcome to the forums!

This is an unfortunate error message which is very misleading. The problem is that you are trying to access the Item property without using an index. The output of BinaryRegionAnalysis is a list of many objects, all the objects that were detected in the frame. In order to access a specific object you need to indicate which one of them you want. In order to do this, you have to select the Source.Item node and replace it with Source.Item[0] for example, to get the first object in the list.

However, this is not necessarily what you are interested in. If you want to track the largest object in the image, you may want to use the LargestBinaryRegion node to automatically get the largest object in the list. Alternatively, you can use SortBinaryRegions in order to order the objects in descending order of size.

If you tell us what exactly you were trying to do we may be able to provide better guidance.

Hope this helps.

--
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/dc294d1d-e682-4de8-a11e-b7b063d4bf6e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

pedro.bio...@gmail.com

unread,
Aug 29, 2017, 7:41:05 AM8/29/17
to Bonsai Users, pedro.bio...@gmail.com
Thank you for your fast reply! Again I'm still learning how to work with Bonsai, couldn't quite figure out what was happening. 
I've managed to obtain what I wanted in another way, thank you again!


On Tuesday, 29 August 2017 02:24:09 UTC+1, goncaloclopes wrote:
Hi Pedro and welcome to the forums!

This is an unfortunate error message which is very misleading. The problem is that you are trying to access the Item property without using an index. The output of BinaryRegionAnalysis is a list of many objects, all the objects that were detected in the frame. In order to access a specific object you need to indicate which one of them you want. In order to do this, you have to select the Source.Item node and replace it with Source.Item[0] for example, to get the first object in the list.

However, this is not necessarily what you are interested in. If you want to track the largest object in the image, you may want to use the LargestBinaryRegion node to automatically get the largest object in the list. Alternatively, you can use SortBinaryRegions in order to order the objects in descending order of size.

If you tell us what exactly you were trying to do we may be able to provide better guidance.

Hope this helps.
On 28 August 2017 at 22:56, <pedro.bio...@gmail.com> wrote:
Hey there, need some help. I'm terribly new at some of this, but please bear with me.
I'm doing a workflow to trace some mice, and I after Binary Region Analysis, if I right click and choose to add to the workflow any of the outputs under "Item (Bonsai.Vision.ConnectedComponent), I get an error when trying to run the workflow. It's a Runtime Error, with the description, which shows up in portuguese although everything else is in English (running Windows in PT language), "A operação pode destabilizar o tempo de execução", which roughly translates to "This operation might destabilize execution time". 
I've attached a pic of the workflow and error. 
I've looked around but can't find a solution. Any ideas?
Thank you very much

--
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.

Gonçalo Lopes

unread,
Aug 29, 2017, 8:06:16 AM8/29/17
to pedro.bio...@gmail.com, Bonsai Users
Great to hear you got it working. Would you mind briefly sharing with us how you solved the problem so that others in the future might learn something from the thread?

Thanks.

To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@googlegroups.com.

pedro.bio...@gmail.com

unread,
Aug 29, 2017, 8:46:04 AM8/29/17
to Bonsai Users, pedro.bio...@gmail.com
I didn't exactly solve it, I just found a way around the problem. What I wanted to do was get the centroid out and analyse the extremes, so I used LargestBinaryRegion and BinaryRegionExtremes for that, extracting the Centroid from LargestBinaryRegion output, where it doesn't originate the same error. 

I did try your suggestion though, but I get a different error. "O índice estava fora do intervalo. Tem de ser não negativo e inferior ao tamanho da coleção. Nome do parâmetro: Index" which roughly translates to "The index was out of the interval. It must be non negative and inferior to the collection size". This only happens with the output from BinaryRegionAnalysis, output works fine with LargestBinaryRegion node. This happens only if I try to output anything under Item(Bonsai.Vision.ConnectedComponent).

Gonçalo Lopes

unread,
Aug 29, 2017, 8:58:27 AM8/29/17
to pedro.bio...@gmail.com, Bonsai Users
Thanks for the clarification :-)

The error you were having with the indices probably happened because in the first frames there was no object detected in the image, so the list is empty. Trying to access the first position of an empty list causes that error. That is one of the reasons why LargestBinaryRegion is preferred, it still works even if there is no object, but the fields report NaN values.


To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages