ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Edge case bug in TIEDicomTags.SetTag
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

yeohray2

Malaysia
106 Posts

Posted - Dec 03 2021 :  05:32:49  Show Profile  Reply
In the SetTag function, the tags are incorrectly deleted if the sequence tag was not sorted, that tag already exists, and the ReplaceIfExist flag is true.

  idx := -1;  //  this is the start

  if fSorted then  //  is false for sequences i.e. nested DICOM groups
  ...

  if idx > -1 then  //  we won't go in here because idx is still -1
  begin
  ...
  else
  begin
    // append to the end
    idx := fTags.Add(tag);  //  we'll hit this code, so idx will be > 0, as the same tag already exists
  end;


  //  at this point, we have at least 2 identical tags, the old one and the new one.  
  if ReplaceIfExist then
  begin
    // remove possible other replications
    i := 0;
    while i < fTags.Count do
    begin
      if (PIEDicomTag(fTags[i])^.Group = Tag^.Group) and (PIEDicomTag(fTags[i])^.Element = Tag^.Element) and (i <> idx) then
        DeleteTag(i)  //  the old tag will be deleted, which is correct, but because i is not incremented, the new tag will also be deleted as i <> idx (of the new tag)
      else
        inc(i);
    end;
  end;


For now, I've just set the sorted flag to true, though I would prefer not to do that.

Thanks.
Ray

xequte

38611 Posts

Posted - Dec 04 2021 :  15:08:41  Show Profile  Reply
Thanks Ray,

We'll check that.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

xequte

38611 Posts

Posted - Dec 09 2021 :  17:52:09  Show Profile  Reply
Hi Ray

We have a fix available for this. Please email me.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: