imglab icon indicating copy to clipboard operation
imglab copied to clipboard

Copy labelled shape meta data to pasted shape

Open flurmbo opened this issue 7 years ago • 3 comments

Purpose / Goal

Implements #115. Copies category, label, feature point labels, clones attribute and tag arrays and then stores them as properties of a metadata object passed into attachShapeToImg.

This might not be the cleanest implementation. I think it would be better if the shapes in the selectedElements array already had a copy of the metadata, but I wasn't sure how to do that. I am also not completely sure what the difference between shape and getShape(shape.node.id) is.

This implementation seems to work though so thought I would make a pull request anyways to see what others think.

Type

Please mention the type of PR

  • [ ] Bug Fix
  • [ ] Refactoring / Technology upgrade
  • [x] New Feature
  • [ ] Documentation
  • [ ] Other : | Please Specify |

Note : Please ensure that you've read contribution guidelines before raising this PR.

flurmbo avatar Nov 10 '18 05:11 flurmbo

@flurmbo there is an object labelledData which contains all the detail of shape, points, and images. What you need is particular id to get the detail. When you need metadata of a shape or to store it you can directly interact with labelledData. I hope, it can answer your question.

Though you've done the good job to do the changes but I believe some of the changes may introduce the bugs. I'll really appreciate it recheck your changes and test the application.

amitguptagwl avatar Nov 10 '18 05:11 amitguptagwl

Hi @amitguptagwl, thanks for your prompt reply! I think you mean labellingData? If so, I did use that. In the function getMetadata(), I call getShape() which interacts with the labellingData array.

What I don't understand is why the objects returned from labellingData contain the metadata while the objects in selectedElements do not. So perhaps a more intuitive solution than my pull request would be to go in and change how selectedElements is set.

flurmbo avatar Nov 10 '18 15:11 flurmbo

As I said previously, labellingData contains all the detail. When a user copies the shapes from one image, this action should basically capture the shape detail from the workarea and paste the same on other image. Hence it doesn't have metadata. Now as we want to copy the metadata as well, there are 2 solutions I can see;

  1. When a user copies shapes, capture the metadata from the labellingData and save it to copiedElements. When the user pastes the data, read everything from copiedElements and insert into labellingData then re-render the workarea..
  2. When a user copies shapes, capture only the IDs (or necessary data) to copiedElements. When the user pastes the data, read data from labellingData and insert into labellingData then re-render the workarea.

amitguptagwl avatar Nov 11 '18 02:11 amitguptagwl