Skip to content

Rewrite MATLAB import functions with readstruct()#350

Open
Jerry1144 wants to merge 2 commits into
trackmate-sc:masterfrom
Jerry1144:rewrite-in-readstruct-2
Open

Rewrite MATLAB import functions with readstruct()#350
Jerry1144 wants to merge 2 commits into
trackmate-sc:masterfrom
Jerry1144:rewrite-in-readstruct-2

Conversation

@Jerry1144

Copy link
Copy Markdown

One path to #343, rewriting MATLAB import functions with readstruct(). Shifting to MATLAB's own capabilities helps alleviate Java heap size problems. Force push of #344

Specific to this path:

  • readstruct reads everything, so I let trackmateFeatureDeclarations() be the only place (among Spots, Edges, and Graph) that reads the XML, and pass that around as a secret global variable.
  • struct field names may have been changed (according to MATLAB identifiers rule). There's additional logic to guess the original XML Attribute name. May consider moving to a separate function for code reuse.
  • readstruct attempts to detect data types of attributes, so there are tests for "is it imported as double" littered everywhere.
  • Updated to use strings throughout. Output formats remain unchanged.
  • trackmateSpots.m
  • trackmateFeatureDeclarations.m
  • trackmateEdges.m
  • trackmateGraph.m
  • trackmateImageCalibration.m won't do it's silly to read everything under the <Model> node, just to fetch its attributes, but there's no choice of "read attribute only" from readstruct(). I see no reasonable way to do it. not matlab.io.xml.dom.* either, which isn't there yet.
  • importTrackMateTracks.m

Rewritten MATLAB import functions with readstruct(), available since R2020b

Shifting to MATLAB's own capabilities helps alleviate Java heap size problems.
MATLAB's memory use will skyrocket during run, but memory pressure will not.

Caveat:
readstruct() automatically converts imported data into "appropriate" forms, and
there's no control over that.
@Jerry1144 Jerry1144 closed this Jun 19, 2026
@Jerry1144 Jerry1144 deleted the rewrite-in-readstruct-2 branch June 19, 2026 06:41
@Jerry1144 Jerry1144 restored the rewrite-in-readstruct-2 branch June 19, 2026 06:41
@Jerry1144 Jerry1144 deleted the rewrite-in-readstruct-2 branch June 19, 2026 06:42
@Jerry1144 Jerry1144 restored the rewrite-in-readstruct-2 branch June 19, 2026 06:42
@Jerry1144 Jerry1144 reopened this Jun 19, 2026
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

Successfully merging this pull request may close these issues.

1 participant