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

Inconsistent reading and writing in StatismoIO #426

Closed
Andreas-Forster opened this issue Feb 26, 2024 · 1 comment
Closed

Inconsistent reading and writing in StatismoIO #426

Andreas-Forster opened this issue Feb 26, 2024 · 1 comment
Labels

Comments

@Andreas-Forster
Copy link
Member

There is an inconsistency in writing and reading data. This makes it possible to write models which can't be read in again. The concrete problem is: If no cells are present, nothing is written, but reading a file where no cells are written fails. The following lines show the issue:

Nothing is written if cells are empty here:
https://github.com/unibas-gravis/scalismo/blob/main/src/main/scala/scalismo/io/statisticalmodel/StatismoIO.scala#L162

Reading throws if cells are not present here:
https://github.com/unibas-gravis/scalismo/blob/main/src/main/scala/scalismo/io/statisticalmodel/StatismoIO.scala#L296
and for-comprehension does not handle the error but simply fails here:
https://github.com/unibas-gravis/scalismo/blob/main/src/main/scala/scalismo/io/statisticalmodel/StatismoIO.scala#L279

Proposal, we make sure that:

  • the for-comprehension continues
  • the cells are passed along as None when creating the domain.
@madsendennis
Copy link
Collaborator

This seems to be the problem mentioned in #332 as well. I'll close the other issue as it wasn't as specific, and we can continue the bug in this issue.
I like the proposal, don't fail when no cells are available, but return None.
Then when creating the domain, we could use createDomainWithCells instead of createDomainWithCells as in the readPointSetRepresentation function.

Andreas-Forster added a commit that referenced this issue Mar 21, 2024
…g-and-writing-in-statismoio

Fix/426 inconsitent reading and writing in statismoio

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

No branches or pull requests

2 participants