# 'Patient position' value changes after Q/R

**URL:** https://discourse.orthanc-server.org/t/patient-position-value-changes-after-q-r/382
**Category:** Google Groups archive
**Created:** [March 18, 2016, 5:58pm UTC](https://discourse.orthanc-server.org/t/patient-position-value-changes-after-q-r/382 "2016-03-18T17:58:59Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Simone\_Pertutti](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/s/7ab992/32.png) [@Simone\_Pertutti](https://discourse.orthanc-server.org/u/Simone_Pertutti)
#### Post date: [March 18, 2016, 5:58pm UTC](https://discourse.orthanc-server.org/t/patient-position-value-changes-after-q-r/382/1 "2016-03-18T17:58:59Z")

</div>

Hello to everyone,  
I'm a new Orthanc user.

I'm writing because I've noticed that patient position changes when I query/retrieve a study from the PACS.

Has this already happened to someone else? Do you have hints?

---

<div class="post-metadata">

### Author: ![jodogne](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/jodogne/32/1511_2.png) [@jodogne](https://discourse.orthanc-server.org/u/jodogne)
#### Post date: [March 18, 2016, 7:29pm UTC](https://discourse.orthanc-server.org/t/patient-position-value-changes-after-q-r/382/2 "2016-03-18T19:29:05Z")

</div>

Hello,

Orthanc never modifies by itself the content of DICOM tags of the files it receives.

I suspect your problem is on the side of your sender.

If not, please provide a sample file so that we can further analyze the issue.

Regards,  
Sébastien-

---

<div class="post-metadata">

### Author: ![Simone\_Pertutti](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/s/7ab992/32.png) [@Simone\_Pertutti](https://discourse.orthanc-server.org/u/Simone_Pertutti)
#### Post date: [March 30, 2016, 9:23am UTC](https://discourse.orthanc-server.org/t/patient-position-value-changes-after-q-r/382/3 "2016-03-30T09:23:29Z")

</div>

Hello Sebastien,

you’re right, I’ve just discovered that what Orthanc reads is what actually is in the PACS. But now I’ve another question…  
Is it possible, during Q/R from the PACS, to automatically copy the slice location (0020-1104) inside patient position (0020-0032, third value)?

Regards,  
Simone

---

<div class="post-metadata">

### Author: ![Raul\_Alexis\_Betancor](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/r/bbe5ce/32.png) [@Raul\_Alexis\_Betancor](https://discourse.orthanc-server.org/u/Raul_Alexis_Betancor)
#### Post date: [March 30, 2016, 11:24am UTC](https://discourse.orthanc-server.org/t/patient-position-value-changes-after-q-r/382/4 "2016-03-30T11:24:03Z")

</div>

Yes, you need to do a lua script that store that tag as you whant, there is examples of lua scripts modifing DICOM tags on the repository

---

<div class="post-metadata">

### Author: ![Simone\_Pertutti](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/s/7ab992/32.png) [@Simone\_Pertutti](https://discourse.orthanc-server.org/u/Simone_Pertutti)
#### Post date: [March 30, 2016, 1:14pm UTC](https://discourse.orthanc-server.org/t/patient-position-value-changes-after-q-r/382/5 "2016-03-30T13:14:40Z")

</div>

Yes, I understand that and I’ve already found the script to do it. What I’m asking is: how can I reference the third value of Patient Position Tag? Is it like a vector?  
Sorry but this is the first time I try to edit DICOM fields…

---

<div class="post-metadata">

### Author: ![Simone\_Pertutti](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/s/7ab992/32.png) [@Simone\_Pertutti](https://discourse.orthanc-server.org/u/Simone_Pertutti)
#### Post date: [March 30, 2016, 5:09pm UTC](https://discourse.orthanc-server.org/t/patient-position-value-changes-after-q-r/382/6 "2016-03-30T17:09:16Z")

</div>

Should the example script work in a C-Move operation?  
Or the study needs to be firstly stored in Orthanc, edited with the script and only at this point it can be sent to Orthanc?

---

<div class="post-metadata">

### Author: ![jodogne](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/jodogne/32/1511_2.png) [@jodogne](https://discourse.orthanc-server.org/u/jodogne)
#### Post date: [April 4, 2016, 9:18am UTC](https://discourse.orthanc-server.org/t/patient-position-value-changes-after-q-r/382/7 "2016-04-04T09:18:58Z")

</div>

Hello,

> > Yes, I understand that and I’ve already found the script to do it. What I’m asking is: how can I reference the third value of Patient Position Tag? Is it like a vector?  
> > Sorry but this is the first time I try to edit DICOM fields…

You could retrieve the third value of the “ImagePositionPatient” tag as follows:

function OnStoredInstance(instanceId, tags, metadata)  
local position = tags[‘ImagePositionPatient’]  
local x, y, z = string.match(position, ‘([^\]_)\([^\]_)\([^\]\*)’)  
print(z)  
end

> Should the example script work in a C-Move operation?  
> Or the study needs to be firstly stored in Orthanc, edited with the script and only at this point it can be sent to Orthanc?

The script above would be applied to any incoming instance (either received by DICOM C-Store, DICOM C-Move, or REST). You can modify these incoming instance as illustrated in the following sample:

[https://bitbucket.org/sjodogne/orthanc/src/default/Resources/Samples/Lua/ModifyInstanceWithSequence.lua](https://bitbucket.org/sjodogne/orthanc/src/default/Resources/Samples/Lua/ModifyInstanceWithSequence.lua)

HTH,

Sébastien-
