-
Notifications
You must be signed in to change notification settings - Fork 81
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
InMemDicomObject Length::UNDEFINED after modify #364
Conversation
- Length::UNDEFINED after modification - to it's inner entries value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for working on this.
Could you adjust some of these methods so that the length is not reset when no changes were truly made? Not that it's a huge problem, but it feels surprising for a method representing an operation as simple as removing an attribute to return an error and still make changes to the underlying object. I left some examples, it should not be hard to do the same for the other methods.
Right, sorry, did not notice.
po 12. 6. 2023 o 10:54 Eduardo Pinho ***@***.***> napísal(a):
… ***@***.**** commented on this pull request.
------------------------------
In object/src/mem.rs
<#364 (comment)>:
> @@ -728,8 +745,8 @@ where
let vr = e.vr();
// replace element
*e = DataElement::empty(tag, vr);
+ self.len = Length::UNDEFINED;
If I see this correctly, actions SetStr, Set, and the various Push* might
also modify data without calling put (see e.g. line 811), so we'd also
need some length resets in apply_push_*_impl and apply_change_value_impl.
—
Reply to this email directly, view it on GitHub
<#364 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ARWGC3H24Z4TWIM5VOB3DDDXK3KMJANCNFSM6AAAAAAZCJZLGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Juraj Mláka
|
I just removed some duplicate code. The methods you mentioned did not need changes, as they internally call |
Still wrong :) Will be back |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Only one minor concern left.
Co-authored-by: Eduardo Pinho <enet4mikeenet@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test failed. Please see the suggestion inline for a possible solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Thank you again, @jmlaka!
As an
InMemDicomObject
can have a certain definedLength
after parsing dicom data,it is necessary to reset or recalculate this Length after calling any methods that modify
the object's inner entries value e.g.
.put()
.remove_element()
...The Length is set to
Length::UNDEFINED
as recalculating it might be expensive.