Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Segmentation Loader - Read additional metadata from .xml file #22

Closed
lucas-diedrich opened this issue Dec 31, 2024 · 2 comments

Comments

@lucas-diedrich
Copy link
Collaborator

lucas-diedrich commented Dec 31, 2024

I recently came across an LMD xml file that contained additional metadata (here: CapID) for each cell as a named tag (minimal example here). Would it be possible to parse these optional metadata tags in pyLMD and add them to the shapes class as additional attributes? I assume that this requires to slightly adjust the Shapes class. Would be happy to open a pull request addressing this.

<?xml version='1.0' encoding='UTF-8'?>
<ImageData>
  <GlobalCoordinates>1</GlobalCoordinates>
  <X_CalibrationPoint_1>0</X_CalibrationPoint_1>
  <Y_CalibrationPoint_1>-0</Y_CalibrationPoint_1>
  <X_CalibrationPoint_2>1</X_CalibrationPoint_2>
  <Y_CalibrationPoint_2>1</Y_CalibrationPoint_2>
  <X_CalibrationPoint_3>0</X_CalibrationPoint_3>
  <Y_CalibrationPoint_3>-1</Y_CalibrationPoint_3>
  <ShapeCount>1</ShapeCount>
  <Shape_1>
    <PointCount>4</PointCount>
    <CapID>A1</CapID>
    <X_1>0</X_1>
    <Y_1>-0</Y_1>
    <X_2>0</X_2>
    <Y_2>-1</Y_2>
    <X_3>1</X_3>
    <Y_3>-0</Y_3>
    <X_4>0</X_4>
    <Y_4>-0</Y_4>
  </Shape_1>
</ImageData>
@lucas-diedrich lucas-diedrich changed the title Segmentation Loader - Read additional metadata from .xml file [Feature Request] Segmentation Loader - Read additional metadata from .xml file Dec 31, 2024
@sophiamaedler
Copy link
Collaborator

sophiamaedler commented Jan 8, 2025

The XML files generated by pyLMD do already have the CapID attribute. It is how we can sort specific cells into specific wells.

E.g. Here an excerpt from an XML generated with pyLMD.

<?xml version='1.0' encoding='UTF-8'?>
<ImageData>
  <GlobalCoordinates>1</GlobalCoordinates>
  <X_CalibrationPoint_1>163544</X_CalibrationPoint_1>
  <Y_CalibrationPoint_1>-224933</Y_CalibrationPoint_1>
  <X_CalibrationPoint_2>395437</X_CalibrationPoint_2>
  <Y_CalibrationPoint_2>-9368125</Y_CalibrationPoint_2>
  <X_CalibrationPoint_3>16341075</X_CalibrationPoint_3>
  <Y_CalibrationPoint_3>-163610</Y_CalibrationPoint_3>
  <ShapeCount>1995</ShapeCount>
  <Shape_1>
    <PointCount>28</PointCount>
    <CapID>B2</CapID>
    <X_1>14718600</X_1>
    <Y_1>-7059350</Y_1>
    <X_2>14719346</X_2>
    <Y_2>-7059254</Y_2>
    <X_3>14720103</X_3>
  </Shape_1>
</ImageData>

So I am guessing your problem arises when you try and read an XML into pyLMD? This probably wasn't implemented in the XML reader as it was a newer feature of pyLMD and we didn't go back and update all other functions like we should have. Should be a quick fix though. If you could make a PR that would be awesome :)

@lucas-diedrich
Copy link
Collaborator Author

Thanks for the explanation!

Made PR #32 addressing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants