web stats
Edit DICOM / XML in foreach - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 11-21-2019, 05:16 AM
V3nn3tj3 V3nn3tj3 is offline
Mirth Newb
 
Join Date: Jul 2018
Posts: 11
V3nn3tj3 is on a distinguished road
Default Edit DICOM / XML in foreach

Hi,

I'm trying to change some DICOM information from images recieved by our MR.
The images contain special vendor specific tags, which have the datatype 'UN'. This is not a problem for 'normal' tags, but when having UN as type for lists, dcm4che2 does not want to compile XML to DICOM. What i want to do is to change all 'UN' types that have lists under them to the type 'SQ'. Lists in lists also exist. I wrote the following code, which works but not as expected:

Code:
for each (var node in msg.descendants()) {
	if (node['@vr'].toString() == "UN" && node['@len'].toString() == "-1") {
		node['@vr'] = 'SQ';
	}
}
This changes the message correctly, but the data that is send away from the source to the destination gets 'UN' again on these tags. I can solve this by using the following code. But only when the tag is directly underneath the root, i can not access child lists from tags.

Code:
for each (var node in msg.children()) {
	if (node['@vr'].toString() == "UN" && node['@len'].toString() == "-1") {
		msg[node.name()]['@vr'] = 'SQ';
	}
}
I'm guessing that when i'm directly writing to msg, the data itself is changed (reference), when using node, i'm working on a copy? I cannot work on msg using descendants, as i'm unable to construct the parent tag from the data i've got.

Any ideas?

(atm i'm using the following code which just removes all the lists with datatype 'UN')

Code:
for each (var node in msg.descendants()) {
	if (node['@vr'].toString() == "UN" && node['@len'].toString() == "-1") {
		delete msg[node.name()];
	}
}
Thanks
Reply With Quote
  #2  
Old 11-22-2019, 04:05 PM
stormcel stormcel is offline
OBX.3 Kenobi
 
Join Date: Mar 2010
Location: Phoenix
Posts: 161
stormcel is on a distinguished road
Default

Do you have a destination template that is overwriting those values?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 04:36 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation