ices-eg / SmartDots

SmartDots is the otolith reading software developed by ILVO that ICES is collaborating on
GNU General Public License v3.0
9 stars 2 forks source link

The order of points gets mixed up if put on a broken line #216

Open UlrikaBeier opened 3 years ago

UlrikaBeier commented 3 years ago

According to WMR software developers, this problem should lie within SmartDots (and not the SmartDots@WMR application): The order of registered points is mixed up if points are placed on a line that has been drawn as "broken". Drawing a line with an angle is used in some cases, to make it easier for readers to put points for yearrings. (This is always a line with an obtuse angle, i.e., more than 90° and less than 180°.)

The points are thereafter projected from their positions on the broken line onto a straight line (drawn from the edges of the broken line), to be able to register the distance between the points (as is also done if an ordinary straight line is used).

Regardless if points are put in successive order on the broken line beginning in the middle of the otolith and going outwards, or the other way round (beginning at the edge and going inwards), the order of the registered points gets mixed up.

If a straight line is used, the order of the points is right.

kevinatilvo commented 3 years ago

The software gives a property to the dots called 'dotindex', this will follow the line in the direction of the arrow, regardless of how many segments it contains. So it is the order of the dot when the line is followed, not the order of the mathematical distance to the starting point.

Is the logic above clear or can a situation occur where the logic above does not apply?

Can an example be logged where the order is not correct? For developers: can you log an annotation in the updateannotations api-call? It should contain all line segments and all the dots with their order given by the software.

cmspinto commented 3 years ago

Agree with Kevin, we need an example, if possible the sampleID and tan image showing the bug!

Fl00rtje commented 3 years ago

Thank you for your responses. Let me give you some extra information from and show you our log details. Let me know if you need more information!

This is the information from Henk, who did the tests: "Consider this Dot A and B are placed on the reading line, afterwards a dot C is placed between A and B, A --- C --- B. the order of export is A, C, B. If the reading line is a single line, the order of the dots exported is correct. However if the the line has a kink, the reading line is made out of two lines, the order of export is A, B, C. If the dots are placed one after another, the result is not correct either with a line with a kink."

Fl00rtje commented 3 years ago

Details of a kinked line with the dots in chronological order: result NOT OK.

Return value as: {'Id': UUID('eb7eaa18-bef0-4f22-a185-66527f9534f9'), 'Filename': 'HER_WR_2020_3400048_424.png', 'SampleNumber': '424', 'SampleId': UUID('8977493e-3a95-47e8-a689-47e0df932ed2'), 'AnnotationCount': 3, 'IsReadOnly': False, 'Scale': Decimal('917.00'), 'annotations': [{'id': UUID('baee0cee-cfa9-4f49-9f71-ad9d29e46f13'), 'parameterId': UUID('a3f09848-bd8e-4754-901f-5942ae65484a'), 'fileId': UUID('eb7eaa18-bef0-4f22-a185-66527f9534f9'), 'sampleId': UUID('8977493e-3a95-47e8-a689-47e0df932ed2'), 'analysisId': UUID('2f727eac-dabc-4ea5-ba5f-b19d85a89685'), 'qualityId': UUID('22afa875-e992-4466-b72d-e3bbec5fed30'), 'dateCreation': '2020-11-02T17:44:37.3330024+01:00', 'labTechnicianId': '9f52786e-1d18-11eb-9f5e-70106fe9f3f0', 'labTechnician': 'groot310', 'result': 0, 'isApproved': True, 'isReadOnly': False, 'isFixed': False, 'Nucleus': None, 'Edge': None, 'comment': 'Stompe lijn punten in volgorde: gaat fout.', 'dots': [{'ID': UUID('1eab728a-850a-4724-abf8-31a904499cce'), 'annotationId_id': UUID('baee0cee-cfa9-4f49-9f71-ad9d29e46f13'), 'x': 1766, 'y': 1247, 'width': 10, 'color': '#FFFF0000', 'dotType': 'Seawater', 'dotShape': 'Dot', 'dotIndex': 1}, {'ID': UUID('1d45916e-ecca-438c-8c0b-09d1eda80be2'), 'annotationId_id': UUID('baee0cee-cfa9-4f49-9f71-ad9d29e46f13'), 'x': 1714, 'y': 857, 'width': 10, 'color': '#FFFF0000', 'dotType': 'Seawater', 'dotShape': 'Dot', 'dotIndex': 2}, {'ID': UUID('6b9007eb-8037-492b-8620-b0dfbab67a8a'), 'annotationId_id': UUID('baee0cee-cfa9-4f49-9f71-ad9d29e46f13'), 'x': 1691, 'y': 687, 'width': 10, 'color': '#FFFF0000', 'dotType': 'Seawater', 'dotShape': 'Dot', 'dotIndex': 3}, {'ID': UUID('903780c4-7a02-4c25-ad49-99c8ebd2fc6d'), 'annotationId_id': UUID('baee0cee-cfa9-4f49-9f71-ad9d29e46f13'), 'x': 1549, 'y': 445, 'width': 10, 'color': '#FFFF0000', 'dotType': 'Seawater', 'dotShape': 'Dot', 'dotIndex': 4}], 'lines': [{'ID': UUID('cd870b1e-c8ff-4810-a187-d437dac3c783'), 'annotationId_id': UUID('baee0cee-cfa9-4f49-9f71-ad9d29e46f13'), 'x1': 1766, 'y1': 1247, 'x2': 1689, 'y2': 674, 'width': 2, 'color': '#FF00FFFF', 'lineIndex': 0},

Fl00rtje commented 3 years ago

Details of a straight line with dots in non-chronological order: result OK.

{'id': UUID('3d1d016d-61a5-4401-b1d3-704aaa17a71a'), 'parameterId': UUID('a3f09848-bd8e-4754-901f-5942ae65484a'), 'fileId': UUID('eb7eaa18-bef0-4f22-a185-66527f9534f9'), 'sampleId': UUID('8977493e-3a95-47e8-a689-47e0df932ed2'), 'analysisId': UUID('2f727eac-dabc-4ea5-ba5f-b19d85a89685'), 'qualityId': UUID('22afa875-e992-4466-b72d-e3bbec5fed30'), 'dateCreation': '2020-11-02T15:36:22.0673895+01:00', 'labTechnicianId': '9f52786e-1d18-11eb-9f5e-70106fe9f3f0', 'labTechnician': 'groot310', 'result': 0, 'isApproved': False, 'isReadOnly': False, 'isFixed': False, 'Nucleus': None, 'Edge': None, 'comment': 'Vanaf de rand, volgorde niet opeenvolgend: gaat goed.', 'dots': [{'ID': UUID('fdb52448-bae7-4471-b1ab-f1f72be58254'), 'annotationId_id': UUID('3d1d016d-61a5-4401-b1d3-704aaa17a71a'), 'x': 1664, 'y': 429, 'width': 10, 'color': '#FFFF0000', 'dotType': 'Seawater', 'dotShape': 'Dot', 'dotIndex': 1}, {'ID': UUID('96ea4e3d-24a1-45cc-ab1e-8f67797dcb26'), 'annotationId_id': UUID('3d1d016d-61a5-4401-b1d3-704aaa17a71a'), 'x': 1695, 'y': 585, 'width': 10, 'color': '#FFFF0000', 'dotType': 'Seawater', 'dotShape': 'Dot', 'dotIndex': 2}, {'ID': UUID('150bf4af-d950-46e8-b5a4-eaf18f8c2dcb'), 'annotationId_id': UUID('3d1d016d-61a5-4401-b1d3-704aaa17a71a'), 'x': 1734, 'y': 785, 'width': 10, 'color': '#FFFF0000', 'dotType': 'Seawater', 'dotShape': 'Dot', 'dotIndex': 3}, {'ID': UUID('ca0c15f4-e0d9-4be8-b719-ed4cc2c187c1'), 'annotationId_id': UUID('3d1d016d-61a5-4401-b1d3-704aaa17a71a'), 'x': 1780, 'y': 1020, 'width': 10, 'color': '#FFFF0000', 'dotType': 'Seawater', 'dotShape': 'Dot', 'dotIndex': 4}, {'ID': UUID('5a3a92aa-c789-47e4-9679-144c625f7003'), 'annotationId_id': UUID('3d1d016d-61a5-4401-b1d3-704aaa17a71a'), 'x': 1828, 'y': 1265, 'width': 10, 'color': '#FFFF0000', 'dotType': 'Seawater', 'dotShape': 'Dot', 'dotIndex': 5}], 'lines': [{'ID': UUID('1b96b411-86c9-4aaa-ae5d-f079a321f480'), 'annotationId_id': UUID('3d1d016d-61a5-4401-b1d3-704aaa17a71a'), 'x1': 1644, 'y1': 327, 'x2': 1828, 'y2': 1267, 'width': 2, 'color': '#FF00FFFF', 'lineIndex': 0}]},

kevinatilvo commented 3 years ago

Hey @Fl00rtje , I have reconstructed the kinked line where the order is not ok. I drew it in paint with the info you sent me.

The JSON seems to be incomplete (ending after the first line segment), however I have all information required to make a drawing.

To summarize:

The result looks something like this:

line

So, my question is: Is this not how the software sees the dots? Is it an issue while drawing or after saving and reloading the data?

Fl00rtje commented 3 years ago

Hi @kevinatilvo Thanks for the feedback. Good to hear that you had enough information to draw the example. It seems the dots are in the right order indeed. The calculation of the distance in our files looks like this:

image

The first numbers (10, 20, 30, 40, 50) stand for the dot number (1,2,3,4,5). The result after the numbers, is the measured distance. As you can see it first goes down and then back up again while in reality the dots are in order.

To me it seems that if the order of the dots is send correctly by SmartDots, the issue may be in our code. It's strange though that we never had this issue and that the lines without are kink are calculated OK. Do you know if anything in SmartDots changed that may have caused this? I'll report the results you send me back to Daniel and hear his feedback.