Data Collector
Hi,
I need to define a couple of user measurements in DC.
I tried using the NEW command (Datacollector->Types->New) but it seems that only a limited logical and aritmetric functions can be used (according to the Microsoft documentation).
Both my new measurements require the Square Root math function (Sqr(Region_Area) & Sqr(Feretmax^2 + Feretmin^2)).
any suggestion about how to face this requirement?
Thank you
ciao
Maurizio
I need to define a couple of user measurements in DC.
I tried using the NEW command (Datacollector->Types->New) but it seems that only a limited logical and aritmetric functions can be used (according to the Microsoft documentation).
Both my new measurements require the Square Root math function (Sqr(Region_Area) & Sqr(Feretmax^2 + Feretmin^2)).
any suggestion about how to face this requirement?
Thank you
ciao
Maurizio
0
Answers
Data Collector's formula is limited to basic logical and arithmetical operations, it doesn't support SQRT.
Complex formula can be implemented in user-defined measurements (right in Count/Size), you can check the example projects UserMearurements and UserMeasurements2. Or you can give me the exact formula you want to implement and I will make the sample project for that.
Regards,
Yuri
I had a look of UserMeasurements2 App.
Now is clear how to create the new measurements but not how and where insert the code in my App
A couple of questions:
1. the new measurements must be created and added to the types list any time I load the count/size option file (with the selected measurements) ?
2. Can the user measurements be collected in the Data Collector?
The formulas I need to create are the following:
Sqr(Region_Area) // Sqrt of Area
Sqr(Feretmax^2 + Feretmin^2)). // Sqrt of Minimum Feret Diameter^2 + Maximum Feret Diameter^2
thank you
Maurizio
I've attached the project that will calculate these measurements automatically.
Measurement registration is done in Project_Load event, so as soon as you load the project the measurements will be registered and added to the Selected measurements list:
The measurement calculation is done in the _meas.ComputeValue handler. Feret Sum is calculated as following:
All new custom measurements will be handled in the same way as normal, build in measurements, they support macro recording and can be added to the selected measurements list like this:
Or to the Data Collector, I just recorded that macro clicking the Sync button in the Data Collector when Measurement table is selected:
Please test it and let me know if you have questions.
Regards,
Yuri
Thank you for your exhaustive explanation.
I have implemented your code in my App.
The code has been grouped in a separate module named AddUserMeas.
The AddUserMeas code Thank for your patience Ciao Maurizio
Good that it works directly!
Regarding the options file: you just have to save a new options file with these measurements. Load old options file, add these 2 measurements and then save the options file under the same name.
My project contains 2 classes: UserMeasurementWithRegistration1 and UserMeasurementWithRegistration2, one class per measure, each class contains own _meas_Compute sub, so you should also have 2 of them.
Regards,
Yuri
I looked again on your code and have some more comments:
1. You have AddCutomMeasuresToMeadTable sub inside UserMeasurementWithRegistration class. You should not put any your macros inside this class. The best way is to add another Module2.vb to the project where you have your own public functions. Also AddCutomMeasuresToMeadTable should not be necessary at all if you use Options file that would add these measurements.
I would just recommend to take the complete Module1.vb from my project to yours (you can rename the file if you already have Module1.vb).
2. I see that you call the measurement "Diagonale". Is the purpose of this measurement to calculate diagonal length of rectangular objects? In that case "Caliper Max"(mRgnMaxCaliper) measurement should already provide this measurement.
If you want to calculate rectangle diagonal yourself you should use Width (mRgnWidth) and Length (mRgnLength) measurements that return Feret length along the minor and major axes of the object (two sides of rectangle).
Regards,
Yuri