04-05-2012 08:22 AM
What is the best way to export an ROI Descriptor to a file such that it can be read at a later time during a test. I would like to export a number of ROI descriptors to say a txt file, excel file, or some other choice if there is a better option.
Thanks,
Wade
Solved! Go to Solution.
04-05-2012 08:38 AM
Fastest is to export to datalog file - assuming you will only store the ROI cluster and not want to change this in the near term -this takes only 2 dunctions but is also not human readable.
you can also roll your own txt or xml file or use the labview XML schema (although I find this a little awkward to read).
The 2 most important questions are
1. Do you need to edit this offline (ie human readable)
2. will you store anything other than an array or single element roi?
04-05-2012 08:45 AM
The preference would be human readable, thus allowing us to edit it in some cases. XML might make sense.
04-05-2012 08:57 AM
I did this in a recent project using my own XML utilities
The file looked like:
<ROI_List>
<ROI>
<GlobalRect>
<Left>0<\Left>
<Right>0<\Right>
<Top>0<\Top>
<Bottom>0<\Bottom>
<\GlobalRect>
<Contours>
<Contour>
<Type>....
<ID>.....
<Coordinates> 0, 1, 2.......
<\Contour>
<\Contours>
<\ROI>
<\ROI_List>
This worked great for me, I used my own schema but it did require a moderate amount of work.
XML captured the nested nature of the data nicely.
I would start with the ni schema, much less readaable but no work to implement.
There are some free and for pay toolkits but I wrote my own and like it so I have not explored the other options out there.
04-05-2012 09:01 AM
So there are no simple export options for the ROI Descriptors except to the datalog which is not human readable?
Thanks,
Wade
04-05-2012 10:17 AM
There are numerious options, each with their own pros and cons:
for human readable, use write toXML/ read to XML, the only con is that you have to use NI's schema. If you dont like their schema you can make your own with a little work. Or you can explore some of the open source or buy packages for converting a cluster to XML.
A straight up string could work but would not be as extensible for nested structures such as ROIs which consist of sub clusters and arrays and enumerated types.
Give the NI schema a try and see if it works for you, it will only taka a few minutes to implement.
04-05-2012 10:21 AM
Thanks, that makes sense. I will start with the XML output for the standard NI Schema, and then if we see a need to make changes to the schema we can.
Thanks for the suggestion.