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

Label loading fix #466

Merged
merged 11 commits into from
Nov 3, 2023
Merged

Label loading fix #466

merged 11 commits into from
Nov 3, 2023

Conversation

PaulHax
Copy link
Collaborator

@PaulHax PaulHax commented Oct 22, 2023

Removes favoring of existing labels in useAnnotationTool label deserialization.
Favoring existing labels broke deserialization of edited labels.

But, so config.JSON updates existing tools, add another pass to
importDataSources so config.JSON are applied after session.zip has been applied.

fixes #454

@netlify
Copy link

netlify bot commented Oct 22, 2023

Deploy Preview for volview-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit ea61baf
🔍 Latest deploy log https://app.netlify.com/sites/volview-dev/deploys/65453342321c980008e0c3fe
😎 Deploy Preview https://deploy-preview-466--volview-dev.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Collaborator

@floryst floryst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good!

tests/specs/session-zip.e2e.ts Outdated Show resolved Hide resolved
@PaulHax
Copy link
Collaborator Author

PaulHax commented Oct 23, 2023

Overall looks good!

Cool. Gonna add a couple more tests...

@PaulHax
Copy link
Collaborator Author

PaulHax commented Oct 25, 2023

CI passed! Quick, merge before CI thinks better of it.

But sersiouly, this PR makes somewhat pointless changes to to pipeline.ts so PipelineResults are sort of like Either. I had a bug where bad Remote URLs were not getting returned as PipelineResults with errors. Was thinking that was going to help me deal with nested PipelineResults where a pipeline executes on a array of PipelineResults, throwing if passed a PipelineResult with an error. But too much Typescript for me and chickened out by not calling another Pipeline and just assigning priorirty in importDataSources.ts: https://github.com/Kitware/VolView/pull/466/files#diff-d81d57fafe24c4ee052b91ee8be768e4d1854ceecb2c6e7a9f76f1921005a202R85-R95

@floryst
Copy link
Collaborator

floryst commented Oct 25, 2023

The pipeline results were intended to have an Either-like aspect to them, with at-runtime distinction via the .ok property. The nested piplines are definitely the hardest part to deal with when it comes to specialized loading requirements. I'll look through your changes and see if there's anything we can simplify.

Copy link
Collaborator

@floryst floryst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Splitting loading into a two-stage process (parse into loadable data sources, then load) has one minor downfall of having to wait for all resources to be ready prior to being loaded. This does make having streaming support all the more pertinent, so this two-stage approach is fine for now.

I wonder if we could have just gathered the config.json file instead of loading it and then apply it after the pipeline has run, similar to how we do it for the dicom data sources.

Comment on lines 98 to 100
const priorityOrImportResult = await Promise.all(
dataSources.map((r) => prioritizer.execute(r, importContext))
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a simpler approach would be to add a loadPriority?: number field to ImportResult, then sort on the priority (defaulting to 0 if the key doesn't exist). The priority conversion pipeline + buckets can then be scrapped for a single sort call (or bucket approach). I think it'll be easier to understand and reason about that way.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, what a mess. But better now.

Ran with your "do it like dicom sources" idea. handleConfig just calls done({ config ]). And the pipeline following code calls applyConfig on all resulting ImportResults with configs.

Removes favoring of existing labels in useAnnotationTool label deserialization.
Favoring existing labels broke deserialization of edited labels.

But, so config.JSON updates existing tools, add another pass to
importDataSources so config.JSON are applied after session.zip has been applied.

fixes #454
Test ensures config.json label props modify existing tool
@PaulHax PaulHax requested a review from floryst October 27, 2023 20:51
@PaulHax
Copy link
Collaborator Author

PaulHax commented Oct 27, 2023

Ready for review! Disabled the new e2e test, really flakey.

@aylward
Copy link
Contributor

aylward commented Oct 27, 2023

Might not be due to your changes, but sometimes the rectangle annotation is filled-in, and other times it is not.

image

@aylward
Copy link
Contributor

aylward commented Oct 27, 2023

Also, might not be your code, but the color of "artifact" (gray) doesn't match the color shown when it is drawn (yellow)

image

@aylward
Copy link
Contributor

aylward commented Oct 27, 2023

The icon for rectangle includes control points...the icon for polyline does not

image

@PaulHax
Copy link
Collaborator Author

PaulHax commented Oct 27, 2023

@aylward Thanks for checking it out. I just removed the fillColor property from the default rectangle labels.

Nobody liked the deformed polygon icon we had at first:
https://pictogrammers.com/library/mdi/icon/vector-polygon/

Maybe we swap out rectangle for this:
https://pictogrammers.com/library/mdi/icon/square-outline/

Menu of easly swapped icons here:
https://pictogrammers.com/library/mdi/

@floryst
Copy link
Collaborator

floryst commented Oct 30, 2023

Maybe we swap out rectangle for this:
https://pictogrammers.com/library/mdi/icon/square-outline/

+1 to using square-outline instead of the current one with control points.

@aylward
Copy link
Contributor

aylward commented Oct 30, 2023 via email

@aylward
Copy link
Contributor

aylward commented Oct 30, 2023

How about
https://icon-icons.com/icon/polygon-vector/208958

image

Copy link
Collaborator

@floryst floryst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just 2 comments, but overall LGTM.

Let's not deal with the icons in this PR. We can continue the discussion in a separate issue.

src/io/import/importDataSources.ts Outdated Show resolved Hide resolved
src/io/import/importDataSources.ts Outdated Show resolved Hide resolved
@floryst
Copy link
Collaborator

floryst commented Nov 3, 2023

LGTM!

@floryst floryst merged commit 4d15d43 into Kitware:main Nov 3, 2023
6 checks passed
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.

Label property edits are not deserialized
3 participants